Jquery-Gmap

Hello yii friends!!I have problem with ur extension jquery-gmap. when I call function $marker->capturePosition.CWidget are error like

CMultiFileUpload can’t upload multiple file it can only upload 1 file.

CJuiDialog not open dialog.

How to solve this problem??? Plz help me!! sorry for my bad english. :(

taken from

hope this will help you

my example is how to upload my product images to my images directory created in my application path(in protected folder)

in my view file put this code as form field

here i use only 3 fields, name field, images field and price field.

<!–? php $form=$this->beginWidget(‘CActiveForm’, array(

‘id’=>’product-form’,

‘enableAjaxValidation’=>false,

‘htmlOptions’ => array(‘enctype’ => ‘multipart/form-data’),

)); ?>

<p>Fields with <span>*</span> are required.</p>

<!–?php echo $form->errorSummary($model); ?>

<div>

<!–?php echo $form->labelEx($model,’name’); ?>

<!–?php echo $form->textField($model,’name’,array(‘size’=>60,’maxlength’=>255)); ?>

<!–?php echo $form->error($model,’name’); ?>

</div>

<div>

<!–?php echo $form->labelEx($model,’product_images’); ?>

<!–?php $this->widget(‘CMultiFileUpload’,array(

‘name’=>’other_product_images’,

‘accept’=>’jpg|png’,

‘max’=>5,

‘remove’=>Yii::t(‘ui’,'Remove’),

‘denied’=>’type is not allowed’, //message that is displayed when a file type is not allowed

‘duplicate’=>’file appears twice’, //message that is displayed when a file appears twice

‘htmlOptions’=>array(‘size’=>25),

)); ?>

<!–?php echo $form->error($model,’product_images’); ?>

</div>

<div>

<!–?php echo $form->labelEx($model,’price’); ?>

<!–?php echo $form->textField($model,’price’,array(‘size’=>10,’maxlength’=>10)); ?>

<!–?php echo $form->error($model,’price’); ?>

</div>

<div>

<!–?php echo CHtml::submitButton($model->isNewRecord ? ‘Create’ : ‘Save’); ?>

</div>

<!–?php $this->endWidget(); ?>

</div><!– form –>

this widget send an array of uploaded files

the name of that array we define in ‘name’ element.

we can catch up it in the controller using

CUploadedFile::getInstancesByName() method

$product_images = CUploadedFile::getInstancesByName(‘product_images’);

this is return an array of CUploadedFile instances

we can access each instance through foreach loop

foreach ($primary_product_image as $image => $pic) {

we can save the current image at any where

$pic->saveAs(Yii::getPathOfAlias(‘application’).’/images/original_images/’.$pic->name);

}

hello kumarkulandai !! thank for ur reply!! My problem is jquery-gmap when I use it without call this function

$marker->capturePosition(); CMultiFileUpload it can’t upload multiple image mean I can upload only 1 image.

this my view




<?php

		  $this->widget('CMultiFileUpload', array(

		     'model'=>$model_pic,

		     'name'=>'url',

		     'attribute'=>'url',

		     'accept'=>'jpg|gif|png',

			 'max'=>12,

			 'duplicate'=>'file appears twice', 

			 'denied'=>'type is not allowed',

		    /* 'options'=>array(

			'onFileSelect'=>'function(e, v, m){ alert("onFileSelect - "+v) }',

			'afterFileSelect'=>'function(e, v, m){ alert("afterFileSelect - "+v) }',

			'onFileAppend'=>'function(e, v, m){ alert("onFileAppend - "+v) }',

			'afterFileAppend'=>'function(e, v, m){ alert("afterFileAppend - "+v) }',

			'onFileRemove'=>'function(e, v, m){ alert("onFileRemove - "+v) }',

			'afterFileRemove'=>'function(e, v, m){ alert("afterFileRemove - "+v) }',

		     ),*/

		  ));

		?>


<?php

 

$mod = new TblHotel;

      

Yii::import('ext.jquery-gmap.*');

 

$gmap = new EGmap3Widget();

$gmap->setSize(600, 400);

 

// base options

$options = array(

    'scaleControl' => true,

    'streetViewControl' => false,

    'zoom' => 1,

    'center' => array('12.57601','104.47998'),

    'mapTypeId' => EGmap3MapTypeId::ROADMAP,

    'mapTypeControlOptions' => array(

        'style' => EGmap3MapTypeControlStyle::DROPDOWN_MENU,

        'position' => EGmap3ControlPosition::TOP_RIGHT,

    ),

    'zoomControlOptions' => array(

        'style' => EGmap3ZoomControlStyle::SMALL,

        'position' => EGmap3ControlPosition::TOP_LEFT

    ),

);

$gmap->setOptions($options);


$bmodel=TblHotel::model()->findbyPk($model->hotel_id);

 

$marker = new EGmap3Marker(array(

'title'=>$bmodel->hotel_name_en,

 'draggable'=>true,

 'icon' => array(

				'url' => 'http://google-maps-icons.googlecode.com/files/hotel.png',

				'anchor' => array('x' => 1, 'y' => 25),

			//'anchor' => new EGmap3Point(5,5),

			)

));

//$marker->address =$model->state." ".$model->city." ".$model->address2." ".$model->address1." ".$model->name;

$infoWindow = new EGmap3InfoWindow(

    array('content'=>'hello world!!')

	// array('content'=>$bmodel->name.",".$bmodel->address1.",".$bmodel->address2.",".$bmodel->city.", ".$bmodel->state)

);


$polyOptions = array(

    'fillColor' => 'yellow',

    'strokeColor' => 'red'

);


$circleOptions = array_merge(

        $polyOptions,

        array('radius'=>10)

);

$circle = new EGmap3Circle($circleOptions);





$marker->centerOnMap();

$marker->setMapZoom(16);


 $marker->capturePosition(

            $model,

            'latitude',

            'longitude',

            array('visible','drag')

  

            );

           $gmap->map->captureZoom(

             $model,

             'map_zoom_level',

              true,

              array('class'=>'myCustomClass')

           );





//foreach($bmodel->latitude as $l)

//{


 	 $marker->latLng = array($bmodel->latitude,$bmodel->longitude);

	 $infoWindow->latLng = array($bmodel->latitude,$bmodel->longitude);

	 $circle->latLng = array($bmodel->latitude,$bmodel->longitude);




//}

		$gmap->add($marker);

		$gmap->add($infoWindow);

		$gmap->add($circle);

		$gmap->renderMap();     


?>