@media screen and (-webkit-min-device-pixel-ratio:0) { /* put webkit CSS here*/ .search-form{ margin-top: 8px; margin-bottom: 5px; margin-left: -78px !important; margin-top: -73px; position: absolute; } // for Safari ::i-block-chrome, .eflat-menu li a { padding-right:17px !important; } }
Wednesday, October 28, 2015
Css Hack for Safari Browser
Wednesday, October 14, 2015
Yii Delete Records With Multi Check Box
Yii::app()->clientScript->registerScript('deleteall',' $("#deleteall").click(function(){ var checked=$("#casecategory-grid").yiiGridView("getChecked","casecategory-grid_c0"); var count=checked.length; if(count>0 && confirm("Do you want to delete these "+count+" item(s)")) { $.ajax({ data:{checked:checked}, url:"'.CHtml::normalizeUrl(array('Casecategory/removeall')).'", success:function(data){$("#casecategory-grid").yiiGridView("update",{});}, }); } }); ');
$this->widget('zii.widgets.grid.CGridView', array( 'id'=>'casecategory-grid', 'dataProvider'=>$model->search(), 'filter'=>$model, 'columns'=>array( array( 'class'=>'CCheckBoxColumn', //CHECKBOX COLUMN ADDED. 'selectableRows'=>2, //MULTIPLE ROWS CAN BE SELECTED. ), 'name', array( 'name'=>'parent', 'type'=>'raw', 'value'=>'$data->getparent ? $data->getparent->name : " No Parent"', // 'filter' => CHtml::listData(User::model()->findAll(), 'id', 'fullname'), ), array( 'class'=>'CButtonColumn', ), ), ));
echo CHtml::button("Remove Selected Items",array("id"=>"deleteall")); // Controller public function actionRemoveall() { if(Yii::app()->request->getIsAjaxRequest()) { $checkedIDs=$_GET['checked']; foreach($checkedIDs as $id) Casecategory::model()->deleteByPk($id); } }
Wednesday, October 7, 2015
Create a widget on Yii
// protected/components/SubscriberFormWidget.php class SubscriberFormWidget extends CWidget{ //put your code here public $form; public function run() { $model=new Subscribe; // Uncomment the following line if AJAX validation is needed if(isset($_POST['ajax']) && $_POST['ajax']==='subscribe-form') { echo CActiveForm::validate($model); Yii::app()->end(); } if(isset($_POST['Subscribe'])) { $model->attributes=$_POST['Subscribe']; if($model->save()) $this->redirect(array('view','id'=>$model->id)); } $this->render('subscriberFormWidget',array( 'modelsubs'=>$model, )); // $this->render('subscriberFormWidget', array('modelsubs'=> new Subscribe())); } }
// protected/components/views/subscriberFormWidget.php $form=$this->beginWidget('CActiveForm', array( 'id'=>'subscribe-form', 'action'=>Yii::app()->createUrl('subscribe/create'), 'enableAjaxValidation'=>true, 'enableClientValidation'=>true, 'clientOptions'=>array( 'validateOnSubmit'=>true, ) )); echo $form->error($modelsubs,'mobile_no'); echo $form->textField($modelsubs,'mobile_no',array('size'=>60,'maxlength'=>254,'class'=>'subscribe-now', 'placeholder'=>'Enter Your Mobile Number …')); echo CHtml::submitButton($modelsubs->isNewRecord ? 'Subscribe Now' : 'Save',array('class'=>'btn btn-info btn-lg')); $this->endWidget();Inside any view
$this->widget('SubscriberFormWidget');
Subscribe to:
Posts (Atom)