function user_challan_listname($challan_id)
 {
     if (!empty($challan_id) && $challan_id != '') {
         $criteria = new CDbCriteria();
         $criteria->condition = "id = " . $challan_id;
         $challan = Challan::model()->find()->findByPk($challan_id);
         //$list=OffenceList::model()->findAllByAttributes(array("id"=>array("(".$challan->offence_ids.")")));
         $criteria = new CDbCriteria();
         $html = "";
         if (!empty($challan->offence_ids)) {
             $criteria->condition = "id IN (" . $challan->offence_ids . ")";
             $list = CHtml::ListData(OffenceList::model()->findAll($criteria), "id", "name");
         } else {
             return "";
         }
         foreach ($list as $k => $v) {
             $html .= " >> {$v} ";
         }
         return "{$html}";
     } else {
         return "";
     }
 }
Example #2
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionOffencesList()
 {
     $model = new OffenceList('searchReport');
     $model->unsetAttributes();
     // clear any default values
     $this->render('offencesList', array('model' => $model));
 }
Example #3
0
 function user_challan_fine($challan_id)
 {
     if (!empty($challan_id) && $challan_id != '') {
         $criteria = new CDbCriteria();
         $criteria->condition = "id = " . $challan_id;
         $challan = Challan::model()->find()->findByPk($challan_id);
         //$list=OffenceList::model()->findAllByAttributes(array("id"=>array("(".$challan->offence_ids.")")));
         $criteria = new CDbCriteria();
         if (!empty($challan->offence_ids)) {
             $criteria->condition = "id IN (" . $challan->offence_ids . ")";
             $list = CHtml::ListData(OffenceList::model()->findAll($criteria), "id", "fine");
         } else {
             return array();
         }
         return $list;
     } else {
         return array();
     }
 }
Example #4
0
echo $form->labelEx($model, 'number_of_offence');
?>
            <?php 
echo $form->textField($model, 'number_of_offence', array('value' => 0, 'span' => 5, 'disabled' => true, 'style' => 'font-weight: bold;color:red'));
?>
        </div>  
        <div class="row1" style="margin-bottom:10px;width:700px !important;">
            <div style="float:left;width:700px !important;height:auto;" >
                    <span>List of Offences</span>
                    <span style="margin-left:280px">Offence Commited</span>
                    <?php 
//echo $form->labelEx($model,'offence_ids');
?>
    
                    <?php 
echo $form->dropDownList($model, 'offence_ids[]', CHtml::encodeArray(CHtml::listData(OffenceList::model()->findAll(array('order' => 'id ASC')), 'id', 'fullOffence')), array('options' => $model->user_challan_list(), 'multiple' => 'multiple'), array('style' => 'width:700px !important;height:auto'));
?>
 
                    <?php 
//echo "<pre>";print_r($model->user_challan_list());
//print_r(array('1'=>array('selected'=>true),'2'=>array('selected'=>true)));
?>
                <div style="clear:both;" >
                </div>
            </div>
        </div>
        <div class="row" style="margin-bottom:10px;margin-top:80px;">
            <h4 style="background-color: #49afcd;
    background-image: linear-gradient(to bottom, #5bc0de, #2f96b4);color:#E7FDD6 !important;padding: 6px;background-image: linear-gradient(to bottom, #3AE8EB, #0e8eff) repeat-x scroll 0 0 #335a84; background-repeat: repeat-x;

    border-radius: 4px;
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return OffenceList the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = OffenceList::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }