本文整理汇总了PHP中State::model方法的典型用法代码示例。如果您正苦于以下问题:PHP State::model方法的具体用法?PHP State::model怎么用?PHP State::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类State
的用法示例。
在下文中一共展示了State::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateAction
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));
}
示例2: getAdminForm
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)));
}
示例3: getAdminForm
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)));
}
示例4: actionCreate
/**
* 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));
}
示例5: actionUpdateEmpPStates
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);
}
}
示例6: beforeDelete
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();
}
示例7: getstatesAction
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;
}
示例8: selectstate
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);
}
}
示例9:
}
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
示例10:
{
$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;
示例11:
<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>
示例12: array
?>
<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; ?>
示例13: actiongetstatecity
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);
}
}
示例14: array
<?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))));
示例15: if
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];
}
?>