当前位置: 首页>>代码示例>>PHP>>正文


PHP Phone::model方法代码示例

本文整理汇总了PHP中Phone::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Phone::model方法的具体用法?PHP Phone::model怎么用?PHP Phone::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phone的用法示例。


在下文中一共展示了Phone::model方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Information();
     //                $model->scenario = 'information';
     if (isset($_POST['Information'])) {
         $model->attributes = $_POST['Information'];
         $rnd = rand(0, 9999);
         // generate random number between 0-9999
         $uploadedFile = CUploadedFile::getInstance($model, 'image');
         if ($uploadedFile) {
             $fileName = "{$rnd}-{$uploadedFile}";
             // random number + file name
             $model->image = $fileName;
         }
         //                    var_dump($_POST['Information']['description']);exit;
         $model->user_id = yii::app()->user->id;
         $phone = Phone::model()->findByPk($_POST['phone']);
         $model->phone = $phone->phone;
         $user = Users::model()->findByPk(yii::app()->user->id);
         //            var_dump($user->email);exit;
         $model->email = $user->email;
         $location = Location::model()->findByPk($_POST['location']);
         $model->location = $location->location;
         $model->normal = "Normal";
         $model->description = str_replace("\r\n", "<br />", $_POST['Information']['description']);
         $t = time();
         $model->time = date("Y-m-d", $t);
         if ($model->save()) {
             if ($uploadedFile) {
                 $uploadedFile->saveAs(Yii::app()->basePath . '/../banner/' . $fileName);
                 // image will uplode to rootDirectory/banner/
             }
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:Saqo19,项目名称:heraxos,代码行数:41,代码来源:InformationController.php

示例2: array

<!--	<div class="row">
		<?php 
// echo $form->label($model,'phone');
?>
		<?php 
// echo $form->textField($model,'phone',array('size'=>60,'maxlength'=>256));
?>
	</div>-->
    <div class="form-group row">
        <?php 
echo $form->label($model, 'phone', array('class' => 'control-label'));
?>
        <div class="leb">
    <?php 
$records = Phone::model()->findAll(array('order' => 'phone'));
echo $form->dropDownList($model, 'phone', CHtml::listData($records, 'phone', 'phone'), array('empty' => 'Select Model', 'class' => 'form-control-drop'));
?>
        </div>
    </div>
	<div class="row buttons">
		<?php 
echo CHtml::submitButton('Որոնել', array('class' => 'btn btn-success'));
?>
	</div>

<?php 
$this->endWidget();
?>

</div><!-- search-form -->
开发者ID:Saqo19,项目名称:heraxos,代码行数:30,代码来源:_search.php

示例3: array

<?php

$this->breadcrumbs = array($model->label(2) => array('index'), Yii::t('app', 'Manage'));
$this->menu = array(array('label' => Yii::t('app', 'List') . ' ' . $model->label(2), 'url' => array('index')), array('label' => Yii::t('app', 'Create') . ' ' . $model->label(), 'url' => array('create')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('vendor-mobile-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1><?php 
echo Yii::t('app', 'Manage') . ' ' . GxHtml::encode($model->label(2));
?>
</h1>

<p>
You may optionally enter a comparison operator (&lt;, &lt;=, &gt;, &gt;=, &lt;&gt; or =) at the beginning of each of your search values to specify how the comparison should be done.
</p>

<?php 
echo GxHtml::link(Yii::t('app', 'Advanced Search'), '#', array('class' => 'search-button'));
?>
<div class="search-form">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'vendor-mobile-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', array('name' => 'subdistribution_id', 'value' => 'GxHtml::valueEx($data->subdistribution)', 'filter' => GxHtml::listDataEx(Subdistribution::model()->findAllAttributes(null, true))), array('name' => 'vendor_id', 'value' => 'GxHtml::valueEx($data->vendor)', 'filter' => GxHtml::listDataEx(Vendor::model()->findAllAttributes(null, true))), array('name' => 'phone_id', 'value' => 'GxHtml::valueEx($data->phone)', 'filter' => GxHtml::listDataEx(Phone::model()->findAllAttributes(null, true))), array('class' => 'CButtonColumn'))));
开发者ID:hanihh,项目名称:vvs_v2,代码行数:27,代码来源:admin.php

示例4:

?>
		</div><!-- row -->
		<div class="row">
		<?php 
echo $form->labelEx($model, 'vendor_id');
?>
		<?php 
echo $form->dropDownList($model, 'vendor_id', GxHtml::listDataEx(Vendor::model()->findAllAttributes(null, true)));
?>
		<?php 
echo $form->error($model, 'vendor_id');
?>
		</div><!-- row -->
		<div class="row">
		<?php 
echo $form->labelEx($model, 'phone_id');
?>
		<?php 
echo $form->dropDownList($model, 'phone_id', GxHtml::listDataEx(Phone::model()->findAllAttributes(null, true)));
?>
		<?php 
echo $form->error($model, 'phone_id');
?>
		</div><!-- row -->


<?php 
echo GxHtml::submitButton(Yii::t('app', 'Save'));
$this->endWidget();
?>
</div><!-- form -->
开发者ID:hanihh,项目名称:vvs_v2,代码行数:31,代码来源:_form.php

示例5: loadModel

 /**
  * 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 Phone the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Phone::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:juniorspecialist,项目名称:phone_theservice,代码行数:15,代码来源:PhoneController.php

示例6: array

	<div class="row">
		<?php 
echo $form->label($model, 'vendor_id');
?>
		<?php 
echo $form->dropDownList($model, 'vendor_id', GxHtml::listDataEx(Vendor::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All')));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'phone_id');
?>
		<?php 
echo $form->dropDownList($model, 'phone_id', GxHtml::listDataEx(Phone::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All')));
?>
	</div>

	<div class="row buttons">
		<?php 
echo GxHtml::submitButton(Yii::t('app', 'Search'));
?>
	</div>

<?php 
$this->endWidget();
?>

</div><!-- search-form -->
开发者ID:hanihh,项目名称:vvs_v2,代码行数:29,代码来源:_search.php

示例7: actionsync

 public function actionsync()
 {
     $this->layout = false;
     $return = [];
     $error = 0;
     $lang = 'en';
     $error_count = 0;
     $sync_count = 0;
     $in_array = array('en', 'ar', 'tr');
     $history_intry = new VoucherHistory();
     $history_intry->action = VoucherAction::model()->find("name = 'SYNC'")->id;
     if (isset($_POST) && !empty($_POST)) {
         // IMPORT MOBILE DATA
         $post = "";
         //foreach ($_POST as $key => $value) {
         //    $post .= $key . " => " . $value . "/";
         //}
         $history_intry->parameters = $post;
         if (isset($_POST['lang']) && !empty($_POST['lang']) && in_array($_POST['lang'], $in_array)) {
             $lang = filter_input(INPUT_GET, "lang", FILTER_SANITIZE_STRING);
         }
         if (!isset($_POST['redeemed_voucher']) || empty($_POST['redeemed_voucher'])) {
             $this->respond('ERR_INVALID_REEQUEST', [], $lang, $history_intry);
         }
         if (!isset($_POST['imei']) || empty($_POST['imei'])) {
             $this->respond('ERR_INVALID_REEQUEST', [], $lang, $history_intry);
         }
         $voucher_codes = $_POST['redeemed_voucher'];
         $redeem_redeemed_status = VoucherStatus::model()->find("name = :name", array(":name" => "REDEEMED"));
         foreach ($voucher_codes as $voucher_code) {
             $voucher = Voucher::model()->find("code = :code", array(":code" => $voucher_code));
             if (!$voucher) {
                 $error_count += 1;
                 $error .= $voucher_code . ", ";
             } else {
                 $voucher->status_id = $redeem_redeemed_status->id;
                 $voucher->sync_date = new CDbExpression('NOW()');
                 $voucher->update();
                 $voucher->save();
                 $sync_count += 1;
             }
         }
         if ($error_count > 0) {
             $err_arr = [];
             $err_arr['count'] = $error_count;
             $err_arr['vouchers'] = $error;
             $this->respond("NOT_ALL_SYNCED", $err_arr, $lang, $history_intry);
         } else {
             $this->respond(NULL, $sync_count, $lang, $history_intry);
         }
     } elseif (isset($_GET) && !empty($_GET)) {
         // SEND NEW DATA
         $get = "";
         foreach ($_GET as $key => $value) {
             $get .= $key . " => " . $value . "/";
         }
         $history_intry->parameters = $get;
         if (!isset($_GET['imei']) || empty($_GET['imei'])) {
             $this->respond('ERR_INVALID_REEQUEST', [], $lang, $history_intry);
         }
         if (isset($_GET['lang']) && !empty($_GET['lang']) && in_array($_GET['lang'], $in_array)) {
             $lang = filter_input(INPUT_GET, "lang", FILTER_SANITIZE_STRING);
         }
         $imei = $_GET['imei'];
         $phone = Phone::model()->find("imei = :imei", array(":imei" => $imei));
         if (!$phone) {
             $this->respond('ERR_INVALID_REEQUEST', [], $lang, $history_intry);
         }
         $vendor_mobiles = VendorMobile::model()->findAll("phone_id = :phone_id", array(":phone_id" => $phone->id));
         $export_list = [];
         $update_list = [];
         foreach ($vendor_mobiles as $vendor_mobile) {
             $voucher_status = VoucherStatus::model()->find("name = :name", array(":name" => "PENDING"));
             $vouchers = Voucher::model()->findAll("status_id = :status_id and vendor_id = :vendor_id", array(":status_id" => $voucher_status->id, ":vendor_id" => $vendor_mobile->vendor_id));
             //print_r($vouchers);
             foreach ($vouchers as $voucher) {
                 $obj = new stdClass();
                 if ($voucher->distributionVoucher->subdistribution->distribution->id == $vendor_mobile->distribution_id) {
                     foreach ($voucher as $key => $value) {
                         $obj->{$key} = $value;
                     }
                     $beneficiary = Beneficiary::model()->findByPk($voucher->ben_id);
                     if ($beneficiary->registration_code) {
                         $obj->registration_code = $beneficiary->registration_code;
                     }
                     $subdistribution = $voucher->distributionVoucher->subdistribution;
                     $obj->start_date = $subdistribution->start_date;
                     $obj->expiration_date = $subdistribution->end_date;
                     $obj->status_name = $voucher->status->name;
                     array_push($export_list, $obj);
                     array_push($update_list, $voucher);
                 }
             }
         }
         $this->respond(NULL, $export_list, $lang, $history_intry, false);
         foreach ($update_list as $item) {
             $in_mobile_status = VoucherStatus::model()->find("name = 'IN_MOBILE'");
             $item->status_id = $in_mobile_status->id;
             $item->update();
             $item->save();
//.........这里部分代码省略.........
开发者ID:hanihh,项目名称:vvs_v2,代码行数:101,代码来源:VoucherController.php


注:本文中的Phone::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。