示例#1
0
 public function store(Request $request)
 {
     $state = new state(array('state_abr' => $request->get('state_abr'), 'state' => $request->get('state')));
     $state->save();
     Toastr::success('State created.');
     return redirect('/states');
 }
示例#2
0
 public static function run()
 {
     if (!isset($_SERVER['REDIRECT_URL'])) {
         throw new Exception();
     }
     $_SERVER['REDIRECT_URL'] = substr($_SERVER['REDIRECT_URL'], strlen(config::prefix()));
     $path = explode('/', $_SERVER['REDIRECT_URL']);
     //array_shift($path);
     if ($path && preg_match('/^[0-9a-z]+$/i', $path[0])) {
         req::$controller = array_shift($path);
         if ($path && preg_match('/^[0-9a-z]+$/i', $path[0])) {
             req::$function = array_shift($path);
         }
     }
     unset($path);
     session::get_instance()->start();
     if (uuid::check(req::$controller)) {
         $obj = state::load(req::$controller);
         if (!$obj instanceof ctrl) {
             throw new Exception();
         }
         call_user_func(array($obj, req::$function));
     } else {
         $obj = eval('return new ' . req::$controller . '_ctrl();');
         if (!$obj instanceof ctrl) {
             throw new Exception();
         }
         util::redirect($obj, req::$function, $_GET);
     }
 }
示例#3
0
 public function actionAjaxState()
 {
     $country = country::model()->findByPk($_POST['address']['address_country_ID']);
     if ($country && $country->contain_states == 1) {
         echo CHtml::dropDownList('address[address_state_ID]', '', state::items($country->country_ID), array('id' => 'state'));
     } else {
         echo CHtml::dropDownList('address[address_state_ID]', '', array(0 => '----------------------------------------'), array('id' => 'state'));
     }
 }
示例#4
0
 public static function href($ctrl = 'home', $func = 'index', $req = array(), $sep = '&')
 {
     if ($ctrl instanceof ctrl) {
         $ctrl = state::save($ctrl);
     } elseif ($ctrl === null) {
         $ctrl = req::$controller;
     }
     return util::webroot() . $ctrl . '/' . $func . '?' . http_build_query($req, '', $sep);
 }
示例#5
0
 public function getState(Request $req)
 {
     $country = Country::find($req->id);
     $state = state::where('country_code', $country->code)->get();
     $html = '<option value="" selected>Choose Option</option>';
     foreach ($state as $states) {
         $html .= '<option value="' . $states->id . '">' . $states->name . '</option>';
     }
     echo $html;
 }
示例#6
0
 public static function load($uuid)
 {
     if (!uuid::check($uuid)) {
         throw new Exception('expected uuid');
     }
     list($key, $obj) = unserialize(file_get_contents(util::base() . '/state/' . $uuid));
     if (state::key() !== $key) {
         throw new Exception('permission denied');
     }
     return $obj;
 }
示例#7
0
 public function loadModel()
 {
     if ($this->_model == null) {
         if (isset($_GET['id'])) {
             $condition = '';
             $this->_model = state::model()->findByPk($_GET['id'], $condition);
         }
         if ($this->_model == null) {
             throw new CHttpException(404, "The requested page does not exist!");
         }
     }
     return $this->_model;
 }
示例#8
0
 public function getRegister()
 {
     if (CNF_REGIST == 'false') {
         if (\Auth::check()) {
             return Redirect::to('admin/')->with('message', \SiteHelpers::alert('success', 'Youre already login'));
         } else {
             return Redirect::to('admin/user/login');
         }
     } else {
         $data['states'] = state::where('status', '=', 'active')->get(array('pk_state_id', 'state_name'));
         // echo "<pre>";
         // print_r($data['states']);
         // die;
         return view('frontend.register', $data)->render();
     }
 }
示例#9
0
 public function regenerate()
 {
     session_regenerate_id();
     state::key_clear();
 }
示例#10
0
文件: index.php 项目: htom78/XZB2c
<div id="addressGrid">
    <?php 
$this->widget('TradeGrid', array('dataProvider' => $model->search(), 'filter' => $model, 'htmlOptions' => array('class' => 'hor-scroll'), 'columns' => array(array('header' => '编号', 'name' => 'address_ID', 'type' => 'raw'), array('header' => '姓', 'name' => 'address_lastname', 'type' => 'raw'), array('header' => '名', 'name' => 'address_firstname', 'type' => 'raw'), array('header' => '国家', 'name' => 'address_country_ID', 'value' => 'country::item($data->address_country_ID)', 'filter' => country::items(), 'type' => 'raw'), array('header' => '州/省', 'name' => 'address_state_ID', 'value' => 'state::item($data->address_state_ID)', 'filter' => state::items(), 'type' => 'raw'), array('header' => '城市', 'name' => 'address_city', 'type' => 'raw'), array('header' => '激活', 'name' => 'address_active', 'value' => 'lookup::item("YesAndNo",$data->address_active)', 'filter' => lookup::items('YesAndNo'), 'type' => 'raw'), array('header' => '邮编', 'name' => 'address_postcode', 'type' => 'raw'), array('class' => 'CButtonColumn', 'template' => '{update} {delete}'))));
?>
</div>
示例#11
0
文件: update.php 项目: htom78/XZB2c
                            </tr>
                             <tr>
                                <td class="label"><label for="country">国家 <span class="required">*</span></label></td>
                                <td class="value">
                                <?php 
echo $form->dropDownList($model, 'address_country_ID', country::items(), array('class' => 'required-entry required-entry input-select', 'id' => 'country', 'name' => 'address[address_country_ID]'));
?>
                                </td>
                                <td class="scope-label"><span class="nobr"></span></td>
                                <td><small>&nbsp;</small></td>
                            </tr>
                            <tr>
                                <td class="label"><label for="state">州/省 <span class="required">*</span></label></td>
                                <td class="value">
                                <?php 
echo $form->dropDownList($model, 'address_state_ID', state::items($model->address_country_ID), array('class' => 'required-entry required-entry input-select', 'id' => 'state', 'name' => 'address[address_state_ID]', 'prompt' => '-----------------------------------------------------------------'));
?>
                                </td>
                                <td class="scope-label"><span class="nobr"></span></td>
                                <td><small>&nbsp;</small></td>
                            </tr>
                             <tr>
                                <td class="label"> <label for="phone">电话<span class="required">*</span></label></td>
                                <td class="value">
                                <?php 
echo $form->textField($model, 'address_phone', array('class' => 'required-entry required-entry input-text', 'name' => 'address[address_phone]', 'id' => 'phone'));
?>
                                </td>
                                <td class="scope-label">
                                    <span class="nobr"><?php 
echo $form->error($model, 'address_phone');
示例#12
0
function getstates($obj)
{
    $state = new state();
    return $state->getall();
}