function updateAction() { $model = new Address(); // Uncomment the following line if AJAX validation is needed $this->performAjaxValidation($model); if (isset($_POST['ajax']) && $_POST['ajax'] == 'categorys-form') { if (isset($_POST['AFID_ALL']) || isset($_POST['AFID']) && !$_POST['AFID']) { $_POST['AFID'] = NULL; } $model->fillFromArray($_POST, FALSE); $model->user_id_updated = $this->user->user_id; $model->updated = 'NOW():sql'; $model->model_uset_id = $this->user->user_id; if ($model->save()) { Message::echoJsonSuccess(__('address_updated')); } else { Message::echoJsonError(__('address_not_updated')); } die; } $id = AF::get($this->params, 'id', FALSE); if (!$id) { throw new AFHttpException(0, 'no_id'); } if (!$model->findByPk($id)) { throw new AFHttpException(0, 'incorrect_id'); } $countries = Country::model()->cache()->findAllInArray(); $states = $model->country_id ? State::model()->getStatesByCID($model->country_id) : array(); $this->addToPageTitle('Update address'); Assets::js('jquery.form'); $this->render('update', array('model' => $model, 'countries' => $countries, 'states' => $states)); }
public function getAdminForm() { if (empty($this->origincountry)) { $this->origincountry = (int) _xls_get_conf('DEFAULT_COUNTRY', 224); } return array('title' => 'Note: You can ' . CHtml::link('Set Product Restrictions', '#', array('class' => 'basic', 'id' => get_class($this))) . ' for this module.', 'elements' => array('label' => array('type' => 'text', 'maxlength' => 64), 'accnumber' => array('type' => 'text', 'maxlength' => 64), 'meternumber' => array('type' => 'text', 'maxlength' => 64), 'securitycode' => array('type' => 'text', 'maxlength' => 64), 'authkey' => array('type' => 'text', 'maxlength' => 64), 'originadde' => array('type' => 'text', 'maxlength' => 64), 'origincity' => array('type' => 'text', 'maxlength' => 64), 'originpostcode' => array('type' => 'text', 'maxlength' => 64), 'origincountry' => array('type' => 'dropdownlist', 'items' => CHtml::listData(Country::model()->findAllByAttributes(array('active' => 1), array('order' => 'sort_order,country')), 'id', 'country'), 'ajax' => array('type' => 'POST', 'url' => Yii::app()->controller->createUrl('ajax/getstates'), 'data' => 'js:{"' . 'country_id' . '": $("#' . CHtml::activeId($this, 'origincountry') . ' option:selected").val()}', 'update' => '#' . CHtml::activeId($this, 'originstate'))), 'originstate' => array('type' => 'dropdownlist', 'items' => CHtml::listData(State::model()->findAllByAttributes(array('country_id' => $this->origincountry, 'active' => 1), array('order' => 'sort_order,state')), 'id', 'code')), 'offerservices' => array('type' => 'checkboxlist', 'items' => fedex::$service_types, 'separator' => '', 'template' => '<div class="offerservices">{input} {label}</div>', 'label' => 'Offer these services<br><a onclick="selectall()">Select All</a><br><a onclick="selectnone()">Select None</a><br>'), 'packaging' => array('type' => 'dropdownlist', 'items' => array('YOUR_PACKAGING' => 'Your packaging', 'FEDEX_BOX' => 'FedEx Box', 'FEDEX_PAK' => 'FedEx Pak', 'FEDEX_TUBE' => 'FedEx Tube')), 'ratetype' => array('type' => 'dropdownlist', 'items' => array('RATED_LIST' => 'List Rates', 'RATED_ACCOUNT' => 'Negotiated rates')), 'customs' => array('type' => 'dropdownlist', 'items' => array('CLEARANCEFEE' => 'FedEx Handles Customs Clearance', 'NOCHARGE' => 'My store handles Customs Clearance')), 'restrictcountry' => array('type' => 'dropdownlist', 'items' => Country::getAdminRestrictionList(true)), 'markup' => array('type' => 'text', 'maxlength' => 4), 'product' => array('type' => 'text', 'maxlength' => 64))); }
public function getAdminForm() { if (empty($this->origincountry)) { $this->origincountry = (int) _xls_get_conf('DEFAULT_COUNTRY', 224); } return array('title' => 'Note: You can ' . CHtml::link('Set Product Restrictions', '#', array('class' => 'basic', 'id' => get_class($this))) . ' for this module.', 'elements' => array('label' => array('type' => 'text', 'maxlength' => 64), 'mode' => array('type' => 'dropdownlist', 'items' => array('UPS' => 'Domestic US UPS Mode', 'IUPS' => 'IUPS International UPS Mode')), 'username' => array('type' => 'text', 'maxlength' => 64), 'password' => array('type' => 'text', 'maxlength' => 64), 'accesskey' => array('type' => 'text', 'maxlength' => 64), 'originpostcode' => array('type' => 'text', 'maxlength' => 64), 'origincountry' => array('type' => 'dropdownlist', 'items' => CHtml::listData(Country::model()->findAllByAttributes(array('active' => 1), array('order' => 'sort_order,country')), 'id', 'country'), 'ajax' => array('type' => 'POST', 'url' => Yii::app()->controller->createUrl('ajax/getstates'), 'data' => 'js:{"' . 'country_id' . '": $("#' . CHtml::activeId($this, 'origincountry') . ' option:selected").val()}', 'update' => '#' . CHtml::activeId($this, 'originstate'))), 'originstate' => array('type' => 'dropdownlist', 'items' => CHtml::listData(State::model()->findAllByAttributes(array('country_id' => $this->origincountry, 'active' => 1), array('order' => 'sort_order,state')), 'id', 'code')), 'offerservices' => array('type' => 'checkboxlist', 'items' => ups::$service_types, 'separator' => '', 'template' => '<div class="offerservices">{input} {label}</div>', 'label' => 'Offer these services<br><a onclick="selectall()">Select All</a><br><a onclick="selectnone()">Select None</a><br>'), 'package' => array('type' => 'dropdownlist', 'items' => ups::$package_types), 'ratecode' => array('type' => 'dropdownlist', 'items' => ups::$rate_types), 'customerclassification' => array('type' => 'dropdownlist', 'items' => array('04' => 'Retail', '03' => 'Occasional', '01' => 'Wholesale')), 'restrictcountry' => array('type' => 'dropdownlist', 'items' => Country::getAdminRestrictionList(true)), 'markup' => array('type' => 'text', 'maxlength' => 4), 'product' => array('type' => 'text', 'maxlength' => 64))); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Notices(); $model->setScenario('create'); //int_r($_FILES);exit; // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); $path = Yii::app()->basePath . '/../uploads'; if (!is_dir($path)) { mkdir($path); } if (isset($_POST['Notices'])) { $model->attributes = $_POST['Notices']; $model->user_id = Yii::app()->User->Id; $user = User::model()->findByPk(Yii::app()->User->Id); $state = State::model()->findByAttributes(array('statecode' => $user->statecode)); $dist = District::model()->findByAttributes(array('distcode' => $user->distcode)); $est = Establishments::model()->findByAttributes(array('id' => $user->est_id)); $model->state = $state->statename; $model->district_court_complex = $dist->distname; $model->establishment = $est->est_name; $model->notice_date = date("Y-m-d H:i:s", time()); $user = User::model()->findByPk(Yii::app()->User->Id); $model->judge_name = $user->judge; $court_no = CourtT::model()->findAllByAttributes(array('judge_id' => $user->judge_id)); $court = ''; foreach ($court_no as $i) { $court = $i['court_no']; break; } $model->court = $court; if ($model->validate($_POST['Notices'])) { //exit("ASd"); if (@(!empty($_FILES['Notices']['name']['pdf_file']))) { $model->pdf_file = $_POST['Notices']['pdf_file']; $model->pdf_file = CUploadedFile::getInstance($model, 'pdf_file'); //$filename = time() . '_' . str_replace(' ', '_', strtolower($model->pdf_file)); if ($_POST['Notices']['notice_type'] == "Advertisment") { $type = 1; } elseif ($_POST['Notices']['notice_type'] == "Sale Notices") { $type = 2; } else { $type = 3; } $filename = $type . "-" . str_replace(' ', '_', $_POST['Notices']['case_type']) . "-" . date("d-m-Y_H:i:s", time()) . ".pdf"; $model->pdf_file->saveAs($path . '/' . $filename); $model->pdf_file = $filename; $model->created = date("Y-m-d H:i:s", time()); $model->notice_date = date("Y-m-d H:i:s", strtotime($model->notice_date)); $model->appear_date = date("Y-m-d H:i:s", strtotime($model->appear_date)); } } if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }
public function actionUpdateEmpPStates() { $data = State::model()->findAll('country_id=:country_id', array(':country_id' => (int) $_REQUEST['EmployeeAddress']['employee_address_p_country'])); $data = CHtml::listData($data, 'state_id', 'state_name'); echo "<option value=''>Select State</option>"; foreach ($data as $value => $name) { echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true); } }
public function beforeDelete() { $state = State::model()->findAll(); foreach ($state as $id => $item) { $states = explode('|', $item->zone_id); if (in_array($this->zone_id, array_values($states))) { Yii::app()->setFlashMessage('Can not delete, Zone in use in state master', 'error'); return false; } } return parent::beforeDelete(); }
function getstatesAction() { $this->checkLogin(); AF::setJsonHeaders('json'); $country_id = AF::get($_POST, 'country_id', false); if (!$country_id) { Message::echoJsonError(__('incorrect_country_id')); } $states = State::model()->getStatesByCID($country_id); Message::echoJsonSuccess(array('message' => $states)); exit; }
function selectstate() { //$data = State::model()->findAll('zone_id=:zone_id', array(':zone_id' => (int) $_POST['zonelist'])); if (isset($_POST['isactive'])) { $data = State::model()->isactive()->findAllByAttributes(array('zone_id' => (int) $_POST['zonelist'])); } else { $data = State::model()->findAllByAttributes(array('zone_id' => (int) $_POST['zonelist'])); } $data = CHtml::listData($data, 'state_id', 'state_Name'); if (count($data)) { foreach ($data as $value => $name) { //echo '<option value=' . $value . ' >' . $name . '</option>'; echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true); } } else { echo CHtml::tag('option', array('value' => '0'), CHtml::encode('No State available'), true); } }
} if ($value == 'student_address_c_line1') { $line1 = StudentAddress::model()->findByPk($stud['student_transaction_student_address_id'])->student_address_c_line1; $line2 = StudentAddress::model()->findByPk($stud['student_transaction_student_address_id'])->student_address_c_line2; $city = City::model()->findByPk(StudentAddress::model()->findByPk($stud['student_transaction_student_address_id'])->student_address_c_city)->city_name; $pin = StudentAddress::model()->findByPk($stud['student_transaction_student_address_id'])->student_address_c_pin; $state = State::model()->findByPk(StudentAddress::model()->findByPk($stud['student_transaction_student_address_id'])->student_address_p_state)->state_name; $label = "Address"; $field_value = $line1 . "," . $line2 . " " . $city . "-" . $pin . "," . $state; } if ($value == 'student_address_p_line1') { $line1 = StudentAddress::model()->findByPk($stud['student_transaction_student_address_id'])->student_address_p_line1; $line2 = StudentAddress::model()->findByPk($stud['student_transaction_student_address_id'])->student_address_p_line2; $city = City::model()->findByPk(StudentAddress::model()->findByPk($stud['student_transaction_student_address_id'])->student_address_p_city)->city_name; $pin = StudentAddress::model()->findByPk($stud['student_transaction_student_address_id'])->student_address_p_pin; $state = State::model()->findByPk(StudentAddress::model()->findByPk($stud['student_transaction_student_address_id'])->student_address_p_state)->state_name; $label = "Address"; $field_value = $line1 . "," . $line2 . " " . $city . "-" . $pin . "," . $state; } if ($value == 'student_mobile_no') { $label = "Contact"; $field_value = StudentInfo::model()->findByPk($stud['student_transaction_student_id'])->student_mobile_no; } if ($value == 'student_guardian_mobile') { $label = "Contact"; $field_value = StudentInfo::model()->findByPk($stud['student_transaction_student_id'])->student_guardian_mobile; } ?> <div class="student-details"> <?php
{ $address = StudentAddress::model()->findByPk($trans->student_transaction_student_address_id); $lin1 = "<b>".$address->student_address_c_line1."</b>"; $lin2 = "<b>".$address->student_address_c_line2."</b>"; $pc = "<b>".$address->student_address_c_pin."</b>"; if($address->student_address_c_city != 0) $ct = "<b>".City::model()->findByPk($address->student_address_c_city)->city_name."</b>"; if($address->student_address_c_state != 0) $stat = "<b>".State::model()->findByPk($address->student_address_c_state)->state_name."</b>"; $padd = "<b>".$address->student_address_p_line1.",".$address->student_address_p_line2."</b>"; if($address->student_address_p_city != 0) $pct = "<b>".City::model()->findByPk($address->student_address_p_city)->city_name."</b>"; if($address->student_address_p_state != 0) $pstat = "<b>".State::model()->findByPk($address->student_address_p_state)->state_name."</b>"; } $ac_pid = $trans->student_academic_term_period_tran_id; $arch = StudentArchiveTable::model()->find(array('condition'=>'student_archive_stud_tran_id='.$trans->student_transaction_id, 'order'=>'student_archive_ac_t_p_id desc')); if($arch) $ac_pid = $arch->student_archive_ac_t_p_id; $year = AcademicTermPeriod::model()->findByPk($ac_pid)->academic_term_period; $ref_no = ""; if(Yii::app()->controller->action->id=="certiview") { $certi= StudentCertificateDetailsTable::model()->find(array('condition'=>' student_certificate_details_table_student_id='.$trans->student_transaction_id.' and student_certificate_type_id='.$certificate_type,'order'=>'student_certificate_details_table_id desc')); $ref_no = $certi->certificate_reference_number; } else{ $certi = StudentCertificateDetailsTable::model()->find(array('order'=>'student_certificate_details_table_id desc')); $autonum = 0;
<tr> <td class="label">Street 1</td><td colspan="3"><?php echo $StudentAddress->student_address_p_line1;?></td> </tr> <tr> <td class="label">Street 2</td><td colspan="3"><?php echo $StudentAddress->student_address_p_line2;?></td> </tr> <tr> <td class="label">Country</td><td><?php if($StudentAddress->student_address_p_country!=0) echo Country::model()->findByPk($StudentAddress->student_address_p_country)->name; else echo ""; ?></td> <td class="label">State</td><td><?php if($StudentAddress->student_address_p_state !=0) echo State::model()->findByPk($StudentAddress->student_address_p_state)->state_name; else echo ""; ?></td> </tr> <tr> <td class="label">Town</td><td><?php echo $StudentAddress->student_address_p_city;?></td> <td class="label">Postcode</td><td><?php echo $StudentAddress->student_address_p_pin;?></td> </tr> <tr> <td class="label">Mobile No</label></td><td><?php echo $StudentAddress->student_address_p_mobile;?></td> <td class="label">Phone No</td><td><?php echo $StudentAddress->student_address_p_phone;?></td> </tr> <tr> <td class="label">House No</label></td><td colspan="3"><?php echo $StudentAddress->student_p_house_no;?></td> </tr>
?> <div class="certificate_main"> <div id="printid1" class="header" style="border-bottom:2px solid"> <div class="logo" > <?php $org_data = Organization::model()->findAll(); echo CHtml::image(Yii::app()->controller->createUrl('/site/loadImage', array('id'=>$org_data[0]->organization_id)),'No Image',array('width'=>80,'height'=>55)); ?> </div> <div class="address" style="font-size:12px;"> <?php echo $org_data[0]->organization_name."</br>"; echo $org_data[0]->address_line1." "; echo $org_data[0]->address_line2."</br>"; echo City::model()->findBypk($org_data[0]->city)->city_name.", ".State::model()->findBypk($org_data[0]->state)->state_name.", ".Country::model()->findBypk($org_data[0]->country)->name."."; ?> </div> </div> <div class="certificate_content"> <div> <div class="content"> <div class="watermark-area"> </div><!--Watermark Div end--> <?php //$updated_cont = str_replace('{name}','Name',$content); echo $content;//Certificate::model()->findByPk($certificate_type)->certificate_content; ?>
public function actiongetstatecity() { $data = State::model()->findAll(array('condition' => 'country_id=' . (int) $_REQUEST['City']['country_id'])); $data = CHtml::listData($data, 'state_id', 'state_name'); foreach ($data as $value => $name) { echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true); } }
<?php $this->breadcrumbs = array('City' => array('admin'), $model->city_name); $this->menu = array(array('label' => '', 'url' => array('create'), 'linkOptions' => array('class' => 'Create', 'title' => 'Add')), array('label' => '', 'url' => array('update', 'id' => $model->city_id), 'linkOptions' => array('class' => 'Edit', 'title' => 'Edit')), array('label' => '', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->city_id), 'confirm' => 'Are you sure you want to delete this item?', 'class' => 'Delete', 'title' => 'Delete')), array('label' => '', 'url' => array('admin'), 'linkOptions' => array('class' => 'Manage', 'title' => 'Manage'))); ?> <h1>View City </h1> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('city_name', array('name' => 'state_id', 'value' => State::model()->findByPk($model->state_id)->state_name), array('name' => 'country_id', 'value' => Country::model()->findByPk($model->country_id)->name))));
else if($key=='employee_designation') $field_value = EmployeeDesignation::model()->findByPk($emp['employee_transaction_designation_id'])->employee_designation_name; else if($key=='employee_address_c_line1') { if(!empty($emp['employee_transaction_emp_address_id'])) { $curr_data = EmployeeAddress::model()->findByPk($emp['employee_transaction_emp_address_id']); $line1 = $curr_data->employee_address_c_line1; $line2 = $curr_data->employee_address_c_line2; if(!empty($curr_data->employee_address_c_city)) $city = City::model()->findByPk($curr_data->employee_address_c_city)->city_name; $pin = $curr_data->employee_address_c_pincode; if(!empty($curr_data->employee_address_c_state)) $state = State::model()->findByPk($curr_data->employee_address_c_state)->state_name; $label = $value; $field_value = $line1.", ".$line2." ".$city."-".$pin.",".$state; } } else { if($key == "employee_dob" || $key == "employee_joining_date") { $field_value = date("d-m-Y",strtotime($emp[$key])); } else $field_value = $emp[$key]; } ?>
<title>Print ID Card</title> <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?> /css/printstudentid.css"/> <?php $gobackimage = CHtml::image('../images/Goback.png', 'No Image', array('height' => '40', 'width' => 40)); echo CHtml::link('GO BACK', Yii::app()->createUrl('report/Studentid'), array('title' => 'Go Back')) . " "; ?> <button style="float:right; margin-right:50%;" onclick="javascript:window.print()" id="printid">Print</button> </div></br></br> <?php $org_id = Yii::app()->user->getState('org_id'); $org_data = Organization::model()->findByAttributes(array('organization_id' => $org_id)); $orgcity = City::model()->findByPk($org_data->city)->city_name; $orgstate = State::model()->findByPk($org_data->state)->state_name; $i = 0; if ($student_data1 && $selected_list) { foreach ($student_data1 as $stud) { $orglogo = CHtml::image(Yii::app()->controller->createUrl('/site/loadImage', array('id' => Yii::app()->user->getState('org_id'))), 'No Image', array('width' => 65, 'height' => 65)); $studphoto = StudentPhotos::model()->findByPk($stud['student_transaction_student_photos_id'])->student_photos_path; ?> <div class="outer"> <!--main div--> <div class="main"> <!--Header div--> <div class="idcardheader"> <div class="logo"> <?php echo $orglogo; ?>
<?php echo CHtml::link('Excel', array('BranchwiseAllStudentsFeesDetailInfoReport','excel'=>'excel','Year[year]'=>$year, 'FeesPaymentTransaction[fees_student_branch_id]'=>$branch), array('class'=>'btnblue'));?> </div> </div> <div class="portlet-body" > <?php $org = Organization::model()->findAll(); $org_data=$org[0]; $branch_model=Branch::model()->findByPk($branch); $yr=Year::model()->findByPk($year); ?> <?php echo '<table class="report-table" border=2 > '; echo "<tr align=center> <th colspan = 60 style=text-align:left;> ".CHtml::image(Yii::app()->controller->createUrl('/site/loadImage', array('id'=>$org_data->organization_id)),'No Image',array('width'=>80,'height'=>55,'style'=>'float:left;margin-left:200px;')) ." <big> <b>".$org_data->organization_name ."</big><br>". $org_data->address_line1." ".$org_data->address_line2."</br>" . City::model()->findBypk($org_data->city)->city_name.", ".State::model()->findBypk($org_data->state)->state_name.", ".Country::model()->findBypk($org_data->country)->name."." ." </th> <br> </tr>"; echo "<tr><th colspan=60><h3> Batch-".$yr->year." Branch of ".$branch_model->branch_name." All Students Fees Collection Report</h3></th> </tr>"; echo "<tr class='table_header'>"; echo "<th > SI<br> No.</th>"; echo "<th> Enrollement<br> No. </th>"; echo "<th colspan=2 > Student Full Name</th>"; foreach($startYear as $y) { echo '<th >'.AcademicTermPeriod::model()->findByPk($y)->academic_term_period.'</th>'; } echo "<th colspan=2> Total Paid Fees </th>"; $m=0;
</tr> <tr> <td align="right" style="text-align: right;"> <label for='state'> <a href="<?php echo CController::createUrl('admin/state/index'); ?> " target="_blank"><?php $clang->eT("State* : "); ?> </a> </label> </td> <td> <?php $state = State::model()->findAll('zone_id=:zone_id', array(':zone_id' => (int) $mrw["zone_id"])); $statelist = CHtml::listData($state, 'state_id', 'state_Name'); echo CHtml::dropDownList('statelist', $mrw['state_id'], $statelist, array('ajax' => array('type' => 'POST', 'data' => array('action' => 'selectcity', 'state_name' => 'js:this.value'), 'url' => CController::createUrl('admin/contact/sa/selectcity'), 'update' => '#citylist'))); ?> </td> <td align="right" style="text-align: right;"> <label for='city'> <a href="<?php echo CController::createUrl('admin/city/index'); ?> " target="_blank"><?php $clang->eT("City* : "); ?> </a> </label> </td>
if (isset($test)) { echo CHtml::image(Yii::app()->controller->createUrl('/site/loadImage', array('id' => Yii::app()->user->getState('org_id'))), 'No Image', array('width' => 114, 'height' => 100)); } ?> </div> <div class="institutename"></div> <div class="title"> <?php $org_data = Organization::model()->findByPk(Yii::app()->user->getState('org_id')); echo $org_data->organization_name; ?> </div> <div class="address"><?php echo $org_data->address_line1 . ' ' . City::model()->findByPk($org_data->city)->city_name . ', ' . State::model()->findByPk($org_data->state)->state_name . ', ' . Country::model()->findByPk($org_data->country)->name; ?> </div> </div> <!------------------------content part-------------------------> <div class="contentpart1"> <div class="receipt">receipt</div> <div class="receipt_header"></div> <div class="rcp_info"> <div class="rcp_rno"> <div class="rno">Receipt no.</div> <div class="rnoline"> <span class="number output"><?php
public function actionUpdateStates() { $data = State::model()->findAll(array('condition' => 'country_id=' . (int) $_REQUEST['Organization']['country'])); $data = CHtml::listData($data, 'state_id', 'state_name'); // echo "<option value=''>Select State</option>"; foreach ($data as $value => $name) { echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true); } }
/** * 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 the ID of the model to be loaded */ public function loadModel($id) { $model = State::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function actionGetstates() { $intCountry = Yii::app()->getRequest()->getPost('country_id'); $data = CHtml::listData(State::model()->findAllByAttributes(array('country_id' => $intCountry, 'active' => 1), array('order' => 'sort_order,state')), 'id', 'code'); if (empty($data)) { $data[0] = "n/a"; } foreach ($data as $key => $val) { echo CHtml::tag('option', array('value' => $key), CHtml::encode($val), true); } }
<?php echo $form->dropDownList($address, 'student_address_p_country', Country::items(), array('prompt' => '-----------Select-----------', 'tabindex' => 9, 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('dependent/UpdateStudPStates'), 'update' => '#StudentAddress_student_address_p_state'))); ?> <span class="status"> </span> <?php echo $form->error($address, 'student_address_p_country'); ?> </div> <div class="row-left"> <?php echo $form->labelEx($address, 'student_address_p_state'); ?> <?php if (isset($address->student_address_p_state)) { echo $form->dropDownList($address, 'student_address_p_state', CHtml::listData(State::model()->findAll(array('condition' => 'country_id=' . $address->student_address_p_country)), 'state_id', 'state_name'), array('prompt' => '-----------Select-----------', 'tabindex' => 10, 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('dependent/UpdateStudPCities'), 'update' => '#StudentAddress_student_address_p_city'))); } else { echo $form->dropDownList($address, 'student_address_p_state', array(), array('prompt' => '-----------Select-----------', 'tabindex' => 10, 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('dependent/UpdateStudPCities'), 'update' => '#StudentAddress_student_address_p_city'))); } ?> <span class="status"> </span> <?php echo $form->error($address, 'student_address_p_state'); ?> </div> </div> <div class="row"> <div class="row-left">
public function actionUpdatestate() { $pk = Yii::app()->getRequest()->getPost('pk'); $name = Yii::app()->getRequest()->getPost('name'); $value = Yii::app()->getRequest()->getPost('value'); if ($value == "*") { $value = null; } if ($name == "state" && $value == '') { State::model()->deleteByPk($pk); echo "delete"; } else { State::model()->updateByPk($pk, array($name => $value)); echo "success"; } }
public function findstate($id) { // Warning: Please modify the following code to remove attributes that // should not be searched. $name = State::model()->findByPk($id); return $name->state_name; }
<td> <?php echo $form->textField($model, 'city', array('rows' => 6, 'cols' => 50)); ?> <?php echo $form->error($model, 'city'); ?> </td></tr> <tr><td> <?php echo $form->labelEx($model, 'state_id'); ?> </td> <td> <?php echo $form->dropDownList($model, 'state_id', CHtml::listData(State::model()->findAll(), 'state_id', 'state'), array('prompt' => 'Please Choose')); ?> <?php echo $form->error($model, 'state_id'); ?> </td></tr> <tr><td> <?php echo $form->labelEx($model, 'no_tel'); ?> </td> <td> <?php echo $form->textField($model, 'no_tel', array('size' => 11, 'maxlength' => 11)); ?> <?php
function updateAction() { $model = new Tax(); // Uncomment the following line if AJAX validation is needed $this->performAjaxValidation($model); if (isset($_POST['model']) && $_POST['model'] == 'Tax') { if (isset($_POST['ajax'])) { $model->fillFromArray($_POST, FALSE); $model->user_id_updated = $this->user->user_id; $model->updated = 'NOW():sql'; $model->model_uset_id = $this->user->user_id; if ($model->save(true, null, false)) { Message::echoJsonSuccess(__('tax_updated')); } else { Message::echoJsonError(__('tax_no_updated')); } die; } $model->save(); $this->redirect(); die; } $id = AF::get($this->params, 'id', FALSE); if (!$id) { throw new AFHttpException(0, 'no_id'); } if (!$model->fillFromDbPk($id)) { throw new AFHttpException(0, 'incorrect_id'); } $countries = Country::model()->cache()->findAllInArray(); $states = State::model()->getStates($model->country_id); Assets::js('jquery.form'); $this->addToPageTitle('Update Tax'); $this->render('update', array('model' => $model, 'states' => $states, 'countries' => $countries)); }
<?php echo $form->dropDownList($model,'country', Country::items(), array( 'prompt' => 'Select Country', 'ajax' => array( 'type'=>'POST', 'url'=>CController::createUrl('Organization/UpdateStates'), 'update'=>'#Organization_state', //selector to update )));?><span class="status"> </span> <?php echo $form->error($model,'country'); ?> </div> <div class="row-right"> <?php echo $form->labelEx($model,'state'); ?> <?php if(isset($model->state)) echo $form->dropDownList($model,'state', CHtml::listData(State::model()->findAll(array('condition'=>'country_id='.$model->country)), 'state_id', 'state_name'), array( 'prompt' => 'Select State', 'ajax' => array( 'type'=>'POST', 'url'=>CController::createUrl('Organization/UpdateCities'), 'update'=>'#Organization_city', //selector to update ))); else echo $form->dropDownList($model,'state', array(), array( 'prompt' => 'Select State', 'ajax' => array( 'type'=>'POST',
echo $form->dropDownList($model, 'country', Country::items(), array('prompt' => 'Select Country', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('Organization/UpdateStates'), 'update' => '#Organization_state'))); ?> <span class="status"> </span> <?php echo $form->error($model, 'country'); ?> </div> <div class="row-right"> <?php echo $form->labelEx($model, 'state'); ?> <?php if (isset($model->state)) { echo $form->dropDownList($model, 'state', CHtml::listData(State::model()->findAll(array('condition' => 'country_id=' . $model->country)), 'state_id', 'state_name'), array('prompt' => 'Select State', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('Organization/UpdateCities'), 'update' => '#Organization_city'))); } else { echo $form->dropDownList($model, 'state', array(), array('prompt' => 'Select State', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('Organization/UpdateCities'), 'update' => '#Organization_city'))); } ?> <span class="status"> </span> <?php echo $form->error($model, 'state'); ?> </div> </div> <div class="row"> <div class="row-left"> <?php echo $form->labelEx($model, 'city'); ?>
else if($s=='employee_address_p_line1') { if($sd['employee_transaction_emp_address_id']!=0) { if(!empty(EmployeeAddress::model()->findByPk($sd['employee_transaction_emp_address_id'])->employee_address_p_city)) { $add_c = "<br/>".City::model()->findByPk(EmployeeAddress::model()->findByPk($sd['employee_transaction_emp_address_id'])->employee_address_p_city)->city_name.", "; } else { $add_c = ''; } if(!empty(EmployeeAddress::model()->findByPk($sd['employee_transaction_emp_address_id'])->employee_address_p_state)) { $add_s = State::model()->findByPk(EmployeeAddress::model()->findByPk($sd['employee_transaction_emp_address_id'])->employee_address_p_state)->state_name.", "; } else { $add_s = ''; } if(!empty(EmployeeAddress::model()->findByPk($sd['employee_transaction_emp_address_id'])->employee_address_p_country)) { $add_co = Country::model()->findByPk(EmployeeAddress::model()->findByPk($sd['employee_transaction_emp_address_id'])->employee_address_p_country)->name; } else { $add_co = ''; } echo "<td style='text-align:center; width:400px;'>".EmployeeAddress::model()->findByPk($sd['employee_transaction_emp_address_id'])->employee_address_p_line1."<br>".EmployeeAddress::model()->findByPk($sd['employee_transaction_emp_address_id'])->employee_address_p_line2."<br>".$add_c."<br>".$add_s."<br>".$add_co."</td>";