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


PHP Templates::model方法代码示例

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


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

示例1: getCurrentTemplate

 public static function getCurrentTemplate($typePage)
 {
     $model = Templates::model()->find(array('select' => 'template, layout', 'condition' => 'group_page = :g AND default_theme = "1"', 'params' => array(':g' => $typePage)));
     if ($model != null) {
         return array('template' => $model->template, 'layout' => $model->layout);
     }
 }
开发者ID:alfinresa,项目名称:demo,代码行数:7,代码来源:Utility.php

示例2: executor

 public function executor()
 {
     $usersModel = User::model()->findAllNotificationExecutors();
     if (is_array($usersModel)) {
         foreach ($usersModel as $user) {
             foreach ($user->zakaz_executor as $zakaz) {
                 if (isset($user->profile)) {
                     $time = explode(':', $user->profile->notification_time);
                 } else {
                     $time[0] = 0;
                 }
                 if (count($time) < 2) {
                     $time[1] = 0;
                 }
                 $date = date('Y-m-d H:i', strtotime($zakaz->author_informed));
                 $date = strtotime($date) - (int) $time[0] * 60 * 60 - (int) $time[1] * 60;
                 $dateStart = strtotime(date('Y-m-d H:i', $date)) - self::INTERVAL * 60;
                 if (time() > $dateStart && time() <= $date) {
                     echo 'Email zakaz #' . $zakaz->id . "\n";
                     $templatesModel = Templates::model()->findByAttributes(array('type_id' => '32'));
                     if ($templatesModel) {
                         $email = new Emails();
                         $email->from_id = 1;
                         $email->to_id = $user->id;
                         $email->name = $user->full_name;
                         $email->sendTo($user->email, $templatesModel->title, $templatesModel->text);
                     }
                 }
                 // Send message executor, when completion of the point
                 foreach ($zakaz->parts as $stage) {
                     if (isset($user->profile)) {
                         $time = explode(':', $user->profile->notification_time);
                     } else {
                         $time[0] = 0;
                     }
                     if (count($time) < 2) {
                         $time[1] = 0;
                     }
                     $date = date('Y-m-d H:i', strtotime($stage->date));
                     $date = strtotime($date) - (int) $time[0] * 60 * 60 - (int) $time[1] * 60;
                     $dateStart = strtotime(date('Y-m-d H:i', $date)) - self::INTERVAL * 60;
                     if (time() > $dateStart && time() <= $date) {
                         echo 'Email stage zakaz #' . $stage->id . "\n";
                         $templatesModel = Templates::model()->findByAttributes(array('type_id' => '33'));
                         if ($templatesModel) {
                             $email = new Emails();
                             $email->from_id = 1;
                             $email->to_id = $user->id;
                             $email->name = $user->full_name;
                             $email->sendTo($user->email, $templatesModel->title, $templatesModel->text);
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:akoch-ov,项目名称:dipstart-development,代码行数:57,代码来源:EventsCommand.php

示例3: actionSend

 public function actionSend()
 {
     $model = new Emails();
     $this->_prepairJson();
     $orderId = $this->_request->getParam('orderId');
     $typeId = $this->_request->getParam('typeId');
     $back = $this->_request->getParam('back');
     $cost = $this->_request->getParam('cost');
     $order = Zakaz::model()->findByPk($orderId);
     $arr_type = array(Emails::TYPE_18, Emails::TYPE_19, Emails::TYPE_20, Emails::TYPE_21, Emails::TYPE_22, Emails::TYPE_23, Emails::TYPE_24);
     if (in_array($typeId, $arr_type)) {
         $user = User::model()->findByPk($order->executor);
     } else {
         $user = User::model()->findByPk($order->user_id);
     }
     $model->to_id = $user->id;
     $profile = Profile::model()->findAll("`user_id`='{$user->id}'");
     $rec = Templates::model()->findAll("`type_id`='{$typeId}'");
     $title = $rec[0]->title;
     $model->name = $profle->firstname;
     if (strlen($model->name) < 2) {
         $model->name = $user->username;
     }
     $model->login = $user->username;
     $model->num_order = $orderId;
     $model->page_order = 'http://' . $_SERVER['SERVER_NAME'] . '/project/chat?orderId=' . $orderId;
     $model->message = $rec[0]->text;
     $model->price_order = $cost;
     $this->sum_order = $cost;
     $model->sendTo($user->email, $rec[0]->text, $typeId);
     $model->save();
     /*		
     		if (!isset($back)) $back = 'index';
             $this->render($back, [
                 'model'=>$model
             ]);
     */
 }
开发者ID:kibercoder,项目名称:dipstart-development,代码行数:38,代码来源:EmailsController.php

示例4: foreach

/**
 * @var array $types
 */
?>

<div class="modal-header">
    <a class="close" data-dismiss="modal">×</a>
    <h4><?php 
echo ProjectModule::t('Please select template');
?>
</h4>
</div>
<div class="modal-body">
    <?php 
foreach ($types as $type) {
    $templates = Templates::model()->findAllByAttributes(['type_id' => $type]);
    $templateNames = [];
    foreach ($templates as $template) {
        $name = $template['name'];
        $template->text = $template->insertVariables($template->text, $orderId);
        if (in_array($name, $templateNames)) {
            continue;
        }
        $templateNames[] = $name;
    }
    ?>
        <div class="chat_templates_wrapper template_type_<?php 
    echo $type;
    ?>
 hidden">
            <?php 
开发者ID:akoch-ov,项目名称:dipstart-development,代码行数:31,代码来源:template_modal.php

示例5:

	<br />

	<b><?php 
echo CHtml::encode($data->getAttributeLabel('title'));
?>
:</b>
	<?php 
echo CHtml::encode($data->title);
?>
	<br />

	<b><?php 
echo CHtml::encode($data->getAttributeLabel('text'));
?>
:</b>
	<?php 
echo CHtml::encode($data->text);
?>
	<br />

	<b><?php 
echo CHtml::encode($data->getAttributeLabel('type'));
?>
:</b>
	<?php 
echo CHtml::encode(Templates::model()->performType($data->type_id));
?>
	<br />


</div>
开发者ID:rahmanjis,项目名称:dipstart-development,代码行数:31,代码来源:_view.php

示例6: register

 /**
  * Registration user
  */
 public static function register($model, $post, $role = 'Customer')
 {
     $model->attributes = $post;
     if (isset($_COOKIE['partner'])) {
         $model->pid = intval($_COOKIE['partner']);
     }
     if ($model->validate()) {
         $soucePassword = UserModule::generate_password(8);
         $model->password = UserModule::encrypting($soucePassword);
         $model->superuser = 0;
         $model->status = 1;
         if ($model->save()) {
             $AuthAssignment = new AuthAssignment();
             $AuthAssignment->attributes = array('itemname' => $role, 'userid' => $model->id);
             $AuthAssignment->save();
             if ($role == 'Author') {
                 if ($model->profile == null) {
                     $profile = new Profile();
                     $profile->user_id = $model->id;
                     $profile->mailing_for_executors = 1;
                     $profile->save();
                 }
             }
             $webmasterlog = new WebmasterLog();
             $webmasterlog->pid = $model->pid;
             $webmasterlog->uid = $model->id;
             $webmasterlog->date = date("Y-m-d");
             $webmasterlog->action = WebmasterLog::REG;
             $webmasterlog->save();
             // новая служба системных сообщений
             $type_id = Emails::TYPE_11;
             $email = new Emails();
             $criteria = new CDbCriteria();
             $criteria->order = 'id DESC';
             $criteria->limit = 1;
             $user = User::model()->findAll($criteria);
             $user = $user[0];
             $email->from_id = 1;
             $email->to_id = $user->id;
             $rec = Templates::model()->findAll("`type_id`='{$type_id}'");
             $id = Company::getId();
             $email->company = Company::getName();
             $email->name = $model->full_name;
             $email->login = $model->email;
             $email->password = $soucePassword;
             $email->page_cabinet = 'http://' . $_SERVER['SERVER_NAME'] . '/user/profile/edit';
             $email->sendTo($user->email, $rec[0]->title, $rec[0]->text, $type_id);
             $identity = new UserIdentity($model->email, $soucePassword);
             $identity->authenticate();
             Yii::app()->user->login($identity, 0);
             //$this->redirect(Yii::app()->controller->module->returnUrl[0]);
             return true;
             //Yii::app()->end();
         } else {
             //Yii::app()->user->setFlash('reg_failed',UserModule::t("Sorry, something wrong... :("));
             //$this->refresh();
             echo 'Cant save';
             Yii::app()->end();
         }
     } else {
         return false;
     }
 }
开发者ID:akoch-ov,项目名称:dipstart-development,代码行数:66,代码来源:RegistrationController.php

示例7: actionSend

 public function actionSend()
 {
     $email = new Emails();
     $this->_prepairJson();
     $orderId = $this->_request->getParam('orderId');
     $typeId = $this->_request->getParam('typeId');
     $back = $this->_request->getParam('back');
     $cost = $this->_request->getParam('cost');
     $order = Zakaz::model()->findByPk($orderId);
     $arr_type = array(Emails::TYPE_18, Emails::TYPE_19, Emails::TYPE_20, Emails::TYPE_21, Emails::TYPE_22, Emails::TYPE_23, Emails::TYPE_24);
     if (in_array($typeId, $arr_type)) {
         $user_id = $order->executor;
     } else {
         $user_id = $order->user_id;
     }
     if (!$user_id) {
         Yii::app()->end();
     }
     $user = User::model()->findByPk($user_id);
     $email->to_id = $user_id;
     $profile = Profile::model()->findAll("`user_id`='{$user_id}'");
     $rec = Templates::model()->findAll("`type_id`='{$typeId}'");
     $title = $rec[0]->title;
     $email->name = $profle->full_name;
     if (strlen($email->name) < 2) {
         $email->name = $user->username;
     }
     $email->login = $user->username;
     $email->num_order = $orderId;
     $email->page_order = 'http://' . $_SERVER['SERVER_NAME'] . '/project/chat?orderId=' . $orderId;
     $email->message = $rec[0]->text;
     $email->price_order = $cost;
     $email->sum_order = $cost;
     $specials = Catalog::model()->findByPk($order->specials);
     $email->specialization = $specials->cat_name;
     $email->name_order = $order->title;
     $email->subject_order = $order->title;
     $email->sendTo($user->email, $rec[0]->title, $rec[0]->text, $typeId);
 }
开发者ID:akoch-ov,项目名称:dipstart-development,代码行数:39,代码来源:EmailsController.php

示例8: actionView

 public function actionView($id)
 {
     $template = Templates::model()->findByPk($id);
     $this->render('view', array('template' => $template));
 }
开发者ID:akoch-ov,项目名称:dipstart-development,代码行数:5,代码来源:TipsController.php

示例9: 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 Templates the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Templates::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, Yii::t('site', 'The requested page does not exist.'));
     }
     return $model;
 }
开发者ID:akoch-ov,项目名称:dipstart-development,代码行数:15,代码来源:TemplatesController.php

示例10: actionIndex

 /**
  *  Вывод и добавление сообщений
  */
 public function actionIndex($orderId)
 {
     $isGuest = Yii::app()->user->isGuest;
     Yii::app()->session['project_id'] = $orderId;
     if (Yii::app()->request->isAjaxRequest) {
         if (Yii::app()->request->getPost('ProjectMessages')) {
             $id = (int) $_POST['ProjectMessages']['id'];
             if ($id > 0) {
                 $model = ProjectMessages::model()->findByPk($id);
             } else {
                 $model = new ProjectMessages();
                 $model->sender = Yii::app()->user->id;
                 $model->moderated = 0;
                 $model->order = $orderId;
             }
             $post = $_POST['ProjectMessages']['message'];
             $post = str_replace("\r\n", '<br>', $post);
             $post = str_replace("\n", '<br>', $post);
             $_POST['ProjectMessages']['message'] = $post;
             $model->attributes = Yii::app()->request->getPost('ProjectMessages');
             $model->date = date('Y-m-d H:i:s');
             switch ($model->recipient) {
                 case 'manager':
                     $model->recipient = 1;
                     break;
                 case 'customer':
                     if (User::model()->isCustomer()) {
                         $model->recipient = Zakaz::model()->resetScope()->findByPk($orderId)->attributes['executor'];
                         $type_id = Emails::TYPE_20;
                     } else {
                         if (User::model()->isAuthor()) {
                             $model->recipient = Zakaz::model()->findByPk($orderId)->attributes['user_id'];
                             $type_id = Emails::TYPE_16;
                         }
                     }
                     $user = User::model()->findByPk($model->recipient);
                     $profile = Profile::model()->findAll("`user_id`='{$model->recipient}'");
                     $email = new Emails();
                     $rec = Templates::model()->findAll("`type_id`='{$type_id}'");
                     $title = $rec[0]->title;
                     $body = $rec[0]->text;
                     $email->name = $user->full_name;
                     if (strlen($email->name) < 2) {
                         $email->name = $user->username;
                     }
                     $email->num_order = $orderId;
                     $email->message = $post;
                     $email->page_order = 'http://' . $_SERVER['SERVER_NAME'] . '/project/chat?orderId=' . $orderId;
                     $email->sendTo($user->email, $body, $type_id);
                     break;
             }
             //print_r($model);
             //echo '<br>$model->save()='.$model->save();
             EventHelper::addMessage($orderId, $model->message);
         }
         $this->renderPartial('chat', array('orderId' => $orderId, 'isGuest' => $isGuest));
         Yii::app()->end();
     }
     $order = Zakaz::model()->resetScope()->findByPk($orderId);
     $parts = ZakazParts::model()->findAll(array('condition' => "`proj_id`='{$orderId}'"));
     if ($isGuest) {
         Yii::app()->theme = 'client';
         // если гость прошёл по ссылке на неcуществующий
         // проект, отправляем его на регистрацию
         $url = 'http://' . $_SERVER['SERVER_NAME'] . '/';
         if (!$order) {
             $this->redirect($url);
         }
         $moderate_types = EventHelper::get_moderate_types_string();
         $events = Events::model()->findAll(array('condition' => "`event_id`='{$orderId}' AND `type` in ({$moderate_types})", 'order' => 'timestamp DESC'), array(':event_id' => $orderId));
         $moderated = count($events) == 0;
         // если гость прошёл по ссылке на непромодерированный
         // проект, отправляем его на регистрацию
         if (!$moderated) {
             $this->redirect(Yii::app()->createUrl('user/login'));
         }
         //			Catalog::model()->tableName();
         //$EmptyChat = UserModule::t('EmptyChat');
         $this->render('index', array('orderId' => $orderId, 'order' => $order, 'executor' => Zakaz::getExecutor($orderId), 'moderated' => $moderated, 'isGuest' => $isGuest, 'parts' => $parts));
         Yii::app()->end();
     }
     $moderate_types = EventHelper::get_moderate_types_string();
     $events = Events::model()->findAll(array('condition' => "`event_id`='{$orderId}' AND `type` in ({$moderate_types})", 'order' => 'timestamp DESC'), array(':event_id' => $orderId));
     $moderated = count($events) == 0;
     $this->render('index', array('orderId' => $orderId, 'order' => $order, 'executor' => Zakaz::getExecutor($orderId), 'moderated' => $moderated, 'isGuest' => $isGuest, 'parts' => $parts));
 }
开发者ID:VahagnM,项目名称:dipstart-development,代码行数:89,代码来源:ChatController.php

示例11: actionView

 public function actionView($orderId)
 {
     $order = Zakaz::model()->resetScope()->findByPk($orderId);
     $parts = ZakazParts::model()->findAll(array('condition' => "`proj_id`='{$orderId}'"));
     $messageForAuthor = Templates::model()->getTemplate(Templates::TYPE_AUTHOR_RESPONSE_PROJECT);
     //$isGuest = Yii::app()->user->isGuest;
     $isGuest = Yii::app()->user->isGuest();
     if ($isGuest || User::model()->isManager()) {
         Yii::app()->theme = 'client';
         // если гость прошёл по ссылке на неcуществующий
         // проект, отправляем его на регистрацию
         $url = 'http://' . $_SERVER['SERVER_NAME'] . '/user/login';
         if (!$order) {
             $this->redirect($url);
         }
         /*$moderate_types = EventHelper::get_moderate_types_string();
         		$events = Events::model()->findAll(array(
         			'condition' => "`event_id`='$orderId' AND `type` in ($moderate_types)",
         			'order' => 'timestamp DESC'
         			),
         			array(':event_id'=> $orderId) 			
         		);
         		$moderated = count($events) == 0;
         		// если гость прошёл по ссылке на непромодерированный
         		// проект, отправляем его на регистрацию
         		if (!$moderated) $this->redirect( Yii::app()->createUrl('user/login'));
         		*/
     } elseif (Yii::app()->user->id == $order->executor) {
         // Current executor
         $this->redirect(Yii::app()->createUrl('/project/chat', array('orderId' => $orderId)));
     }
     if ($isGuest || User::model()->isAuthor()) {
         $buttonTemplates = Templates::model()->findAllByAttributes(array('type_id' => $isGuest ? 30 : 29));
     }
     $this->render('view', array('orderId' => $orderId, 'order' => $order, 'isGuest' => $isGuest, 'parts' => $parts, 'messageForAuthor' => $messageForAuthor, 'buttonTemplates' => $buttonTemplates));
     //Yii::app()->end();
 }
开发者ID:akoch-ov,项目名称:dipstart-development,代码行数:37,代码来源:ChatController.php

示例12: actionRecovery

 /**
  * Recovery password
  */
 public function actionRecovery()
 {
     $form = new UserRecoveryForm();
     Yii::app()->theme = 'client';
     if (Yii::app()->user->id) {
         $this->redirect(Yii::app()->controller->module->returnUrl);
     } else {
         $email = isset($_GET['email']) ? $_GET['email'] : '';
         $activkey = isset($_GET['activkey']) ? $_GET['activkey'] : '';
         if ($email && $activkey) {
             $form2 = new UserChangePassword();
             $find = User::model()->notsafe()->findByAttributes(array('email' => $email));
             if (isset($find) && $find->activkey == $activkey) {
                 if (isset($_POST['UserChangePassword'])) {
                     $form2->attributes = $_POST['UserChangePassword'];
                     if ($form2->validate()) {
                         $find->password = Yii::app()->controller->module->encrypting($form2->password);
                         $find->activkey = Yii::app()->controller->module->encrypting(microtime() . $form2->password);
                         if ($find->status == 0) {
                             $find->status = 1;
                         }
                         $find->save();
                         Yii::app()->user->setFlash('recoveryMessage', UserModule::t("New password is saved."));
                         $this->redirect(Yii::app()->controller->module->recoveryUrl);
                     }
                 }
                 $this->render('changepassword', array('form' => $form2));
             } else {
                 Yii::app()->user->setFlash('recoveryMessage', UserModule::t("Incorrect recovery link."));
                 $this->redirect(Yii::app()->controller->module->recoveryUrl);
             }
         } else {
             if (isset($_POST['UserRecoveryForm'])) {
                 $form->attributes = $_POST['UserRecoveryForm'];
                 if ($form->validate()) {
                     $user = User::model()->notsafe()->findbyPk($form->user_id);
                     $user->activkey = UserModule::encrypting(microtime() . $user->password);
                     $user->save();
                     $activation_url = 'http://' . $_SERVER['HTTP_HOST'] . $this->createUrl(implode(Yii::app()->controller->module->recoveryUrl), array("activkey" => $user->activkey, "email" => $user->email));
                     /*
                     						$this->createUrl(implode(Yii::app()->controller->module->recoveryUrl));
                     						$subject = UserModule::t("You have requested the password recovery site {site_name}",
                     		    					array(
                     		    						'{site_name}'=>Yii::app()->name,
                     		    					));
                     		    			$message = UserModule::t("You have requested the password recovery site {site_name}. To receive a new password, go to <a href=\"{activation_url}\">{activation_url}</a>.",
                     		    					array(
                     		    						'{site_name}'=>Yii::app()->name,
                     		    						'{activation_url}'=>$activation_url,
                     		    					));
                     							
                     		    			UserModule::sendMail($user->email,$subject,$message);
                     */
                     // новая служба системных сообщений
                     $type_id = Emails::TYPE_10;
                     $email = new Emails();
                     /*$criteria = new CDbCriteria();
                     		$criteria->order = 'id DESC';
                     		$criteria->limit = 1;
                     		$user = User::model()->findAll($criteria);
                     		$user = $user[0];*/
                     $email->from_id = 1;
                     $email->to_id = $form->user_id;
                     //  = $user->id;
                     $rec = Templates::model()->findAll("`type_id`='{$type_id}'");
                     $id = Campaign::getId();
                     $email->campaign = Campaign::getName();
                     $email->name = $user->full_name;
                     $email->login = $user->username;
                     $email->password = $soucePassword;
                     $email->page_psw = $activation_url;
                     $email->page_cabinet = 'http://' . $_SERVER['SERVER_NAME'] . '/user/profile/edit';
                     $email->sendTo($user->email, $rec[0]->title, $rec[0]->text, $type_id);
                     Yii::app()->user->setFlash('recoveryMessage', UserModule::t("Please check your email. An instructions was sent to your email address."));
                     $this->refresh();
                 }
             }
             $this->render('recovery', array('form' => $form));
         }
     }
 }
开发者ID:akoch-ov,项目名称:dipstart-development,代码行数:84,代码来源:RecoveryController.php

示例13: array

<div class="row" data-role="<?php 
echo User::model()->isCustomer();
?>
" id="message_send" data-message-send="<?php 
echo Templates::model()->getTemplate(31);
?>
">
<?php 
//if (!Yii::app()->request->isAjaxRequest){
echo CHtml::form();
?>
	
	<div class="chat-text-area">
		<?php 
echo CHtml::label(ProjectModule::t('Message'), 'message', array('id' => 'msgLabel'));
?>
		<?php 
echo CHtml::textArea('message', '', array('rows' => 6, 'class' => 'col-xs-12', 'placeholder' => ProjectModule::t('Enter your message...')));
?>
	</div>
	<div class="chat-edit-text-area" id="div-edit-message" style="display: none;">
		<?php 
echo CHtml::label(ProjectModule::t('Message'), 'edit-message', array('id' => 'msgLabel1'));
?>
		<?php 
echo CHtml::textArea('edit-message', '', array('rows' => 6, 'class' => 'col-xs-12', 'placeholder' => ProjectModule::t('Enter your message...'), 'id' => 'edit-message'));
?>
	</div>

	<?php 
if (count($buttonTemplates)) {
开发者ID:akoch-ov,项目名称:dipstart-development,代码行数:31,代码来源:_accessories.php

示例14: run

 public function run()
 {
     $statuses = $this->getStatus();
     $tips = array();
     foreach ($statuses as $item) {
         $tip = Templates::model()->findByAttributes(['type_id' => 5, 'name' => $item]);
         if ($tip) {
             $tips[] = $tip;
         }
     }
     $this->render('view', array('tips' => $tips));
 }
开发者ID:akoch-ov,项目名称:dipstart-development,代码行数:12,代码来源:TipsWidget.php

示例15: actionStatus

 public function actionStatus()
 {
     $status_id = Yii::app()->request->getPost('status_id');
     $id = Yii::app()->request->getPost('id');
     if (User::model()->isAuthor() && $status_id == '+1' && $id) {
         $stage = ZakazParts::model()->findByPk($id);
         if (User::model()->isExecutor($stage->proj_id) && $stage->status_id == 1) {
             $stage->status_id = 2;
             $stage->save();
             echo $stage->status->status;
             EventHelper::stageDoneByExecutor($stage->proj_id, $stage->title);
         } else {
             echo 'Wrong base status';
         }
     } elseif (User::model()->isCustomer() && $status_id == '+1' && $id) {
         $stage = ZakazParts::model()->findByPk($id);
         if (User::model()->isOwner($stage->proj_id) && $stage->status_id == 3) {
             $stage->status_id = 4;
             $stage->save();
             //echo $stage->status->status;
             echo ProjectModule::t('Approved by me');
             EventHelper::stageDoneByCustomer($stage->proj_id, $stage->title);
         } else {
             echo 'Wrong base status';
         }
     } elseif (User::model()->isManager() && $status_id && $id) {
         $orderId = Yii::app()->request->getPost('orderId');
         $row = array('status_id' => $status_id);
         $condition = array();
         $params = array();
         ZakazParts::model()->updateByPk($id, $row, $condition, $params);
         if ((int) $status_id == 3) {
             $parts = ZakazParts::model()->findAll("`proj_id` = '{$orderId}' AND `status_id` IN (0,1,2)");
             $order = Zakaz::model()->resetScope()->findByPk($orderId);
             $subject_order = $order->title;
             $user_id = $order->user_id;
             $user = User::model()->findByPk($user_id);
             $order->setCustomerEvents(2);
             $email = new Emails();
             if (count($parts) > 0) {
                 $type_id = Emails::TYPE_14;
             } else {
                 $type_id = Emails::TYPE_15;
             }
             $rec = Templates::model()->findAll("`type_id`='{$type_id}'");
             echo count($parts);
             $title = $rec[0]->title;
             $body = $rec[0]->text;
             $email->name = $user->full_name;
             if (strlen($email->name) < 2) {
                 $email->name = $user->username;
             }
             $email->num_order = $orderId;
             //		$model->date = date('Y-m-d H:i:s');
             $email->subject_order = $subject_order;
             $email->num_order = $orderId;
             $email->page_order = 'http://' . $_SERVER['SERVER_NAME'] . '/project/chat?orderId=' . $orderId;
             $email->sendTo($user->email, $rec[0]->title, $rec[0]->text, $type_id);
         }
     }
 }
开发者ID:akoch-ov,项目名称:dipstart-development,代码行数:61,代码来源:ZakazPartsController.php


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