public function loadModel($id)
 {
     if (($model = Feedback::model()->findByPk($id)) === null) {
         throw new CHttpException(404, 'Страница не найдена');
     }
     return $model;
 }
Esempio n. 2
0
 public static function getFeedbackById($id)
 {
     $feedBack = Feedback::model()->findByPk($id);
     if ($feedBack) {
         return $feedBack;
     }
     return null;
 }
 public function run()
 {
     $models = Feedback::model()->finished()->review()->slider()->findAll(array('limit' => (int) $this->limit, 'order' => 't.sort ASC'));
     if (empty($models)) {
         return;
     }
     $this->render($this->view, array('models' => $models));
 }
Esempio n. 4
0
 public function actionView($id)
 {
     $this->data['id'] = $id;
     $this->connection->createCommand("update xm_feedback set haveread = 1 where feedback_id = {$id}")->query();
     $feedback = Feedback::model()->findByPk($id);
     $this->data['feedback'] = $feedback;
     $this->render('view', $this->data);
 }
Esempio n. 5
0
             $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
         }
     } else {
         throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
     }
 }
 /**
  * Lists all models.
  */
Esempio n. 6
0
 public function actionStat()
 {
     $posts = Posts::model()->count();
     $commentsNum = Comments::model()->count();
     $attachsNum = Attachments::model()->count();
     $feedbackNum = Feedback::model()->count();
     $arr = array('posts' => $posts, 'commentsNum' => $commentsNum, 'attachsNum' => $attachsNum, 'feedbackNum' => $feedbackNum);
     $this->render('stat', $arr);
 }
 public function checkSelf()
 {
     $messages = array();
     if (!$this->notifyEmailFrom) {
         $messages[WebModule::CHECK_ERROR][] = array('type' => WebModule::CHECK_ERROR, 'message' => Yii::t('FeedbackModule.feedback', 'Select email which will be display in "From" field {link}', array('{link}' => CHtml::link(Yii::t('FeedbackModule.feedback', 'Change module settings'), array('/yupe/backend/modulesettings/', 'module' => $this->id)))));
     }
     $count = Feedback::model()->new()->count();
     if ($count) {
         $messages[WebModule::CHECK_NOTICE][] = array('type' => WebModule::CHECK_NOTICE, 'message' => Yii::t('FeedbackModule.feedback', 'You have {{count}} ', array('{{count}}' => $count)) . Yii::t('FeedbackModule.feedback', 'new message |new messages |new messages ', $count) . ' ' . CHtml::link(Yii::t('FeedbackModule.feedback', 'Show and reply?'), array('/feedback/feedbackBackend/index/', 'order' => 'status.asc', 'FeedbBack_sort' => 'status')));
     }
     return isset($messages[WebModule::CHECK_ERROR]) || isset($messages[WebModule::CHECK_NOTICE]) ? $messages : true;
 }
Esempio n. 8
0
 public function getFeedbackByEvent($event_id)
 {
     $feedbacks = Feedback::model()->findAllByAttributes(array('event_id' => $event_id));
     $returnArr = array();
     foreach ($feedbacks as $item) {
         $itemArr = $this->getQuestionByFeedback($item->feedback_id);
         if (!empty($itemArr)) {
             $returnArr[] = $itemArr;
         }
     }
     return $returnArr;
 }
Esempio n. 9
0
 public function actionAddUserFeedback()
 {
     try {
         $attr = StringHelper::filterArrayString($_POST);
         if (Feedback::model()->addUserFeedback($attr)) {
             ResponseHelper::JsonReturnSuccess('', 'Success');
         } else {
             ResponseHelper::JsonReturnError('', 'Server Error');
         }
     } catch (Exception $ex) {
         var_dump($ex->getMessage());
     }
 }
Esempio n. 10
0
 public static function getRating($toId, $entityId, $type)
 {
     $criteria = new CDbCriteria();
     $criteria->select = 'avg(rate) AS rate';
     $criteria->condition = 'to_id=:toId AND entity_id=:entityId AND type=:type';
     $criteria->params = array(':toId' => $toId, ':entityId' => $entityId, ':type' => $type);
     $avg_rating = Feedback::model()->find($criteria);
     if ($avg_rating->rate) {
         return $avg_rating->rate;
     } else {
         return false;
     }
 }
 public function checkSelf()
 {
     $messages = array();
     if (!$this->notifyEmailFrom) {
         $messages[WebModule::CHECK_ERROR][] = array('type' => WebModule::CHECK_ERROR, 'message' => Yii::t('FeedbackModule.feedback', 'Select email which will be display in "From" field {link}', array('{link}' => CHtml::link(Yii::t('FeedbackModule.feedback', 'Change module settings'), array('/yupe/backend/modulesettings/', 'module' => $this->id)))));
     }
     $count = Feedback::model()->new()->count();
     if ($count) {
         $messages[WebModule::CHECK_NOTICE][] = array('type' => WebModule::CHECK_NOTICE, 'message' => Yii::t('FeedbackModule.feedback', 'You have {{count}} ', array('{{count}}' => $count)) . Yii::t('FeedbackModule.feedback', 'new message |new messages |new messages ', $count) . ' ' . CHtml::link(Yii::t('FeedbackModule.feedback', 'Show and reply?'), array('/feedback/feedbackBackend/index/', 'order' => 'status.asc', 'FeedbBack_sort' => 'status')));
     }
     $uploadPath = Yii::app()->uploadManager->getBasePath() . DIRECTORY_SEPARATOR . $this->uploadPath;
     if (!is_writable($uploadPath)) {
         $messages[WebModule::CHECK_ERROR][] = array('type' => WebModule::CHECK_ERROR, 'message' => Yii::t('FeedbackModule.feedback', 'Directory "{dir}" is not accessible for write! {link}', array('{dir}' => $uploadPath, '{link}' => CHtml::link(Yii::t('FeedbackModule.feedback', 'Change settings'), array('/yupe/backend/modulesettings/', 'module' => 'feedback')))));
     }
     return isset($messages[WebModule::CHECK_ERROR]) || isset($messages[WebModule::CHECK_NOTICE]) ? $messages : true;
 }
Esempio n. 12
0
 public function actionDelete()
 {
     $companyId = Helper::getCompanyId(Yii::app()->request->getParam('companyId'));
     $ids = Yii::app()->request->getPost('lid');
     $allflag = Yii::app()->request->getParam('allflag', 0);
     Until::isUpdateValid($ids, $this->companyId, $this);
     //0,表示企业任何时候都在云端更新。
     if (!empty($ids)) {
         foreach ($ids as $id) {
             $model = Feedback::model()->find('lid=:id and dpid=:companyId', array(':id' => $id, ':companyId' => $companyId));
             if ($model) {
                 $model->saveAttributes(array('delete_flag' => 1, 'update_at' => date('Y-m-d H:i:s', time())));
             }
         }
         $this->redirect(array('feedback/index', 'companyId' => $companyId, 'allflag' => $allflag));
     } else {
         Yii::app()->user->setFlash('error', yii::t('app', '请选择要删除的项目'));
         $this->redirect(array('feedback/index', 'companyId' => $companyId, 'allflag' => $allflag));
     }
 }
Esempio n. 13
0
 public function actionReply($feedbackid)
 {
     if (Yii::app()->user->checkAccess('createAnswer') == false) {
         throw new CHttpException(403);
     }
     $feedback = Feedback::model()->findByPk($feedbackid);
     $answer = new Answer();
     if (isset($_POST['Answer'])) {
         $answer->attributes = Yii::app()->request->getPost('Answer');
         $answer->reply_time = date('Y-m-d');
         $answer->feedback_id = $feedbackid;
         if ($answer->save()) {
             $this->setFlashMessage(strtr('<strong>{link}</strong> 问题咨询回复成功', array('{link}' => CHtml::link(CHtml::encode($feedback->content), array('view', 'id' => $answer->primaryKey)))));
             $feedback->is_reply = 1;
             $feedback->save();
             $this->redirect(array('answer/index'));
         }
     }
     $this->breadcrumbs = array('问题咨询' => array('feedback/index'), '回复');
     $this->render('reply', array('answer' => $answer, 'feedback' => $feedback));
 }
Esempio n. 14
0
 public function actionIndex()
 {
     $this->pageTitle = Yii::t('common', '反馈中心') . SEPARATOR . Setting::getValueByCode('inside_title', true);
     $criteria = new CDbCriteria();
     $criteria->compare('is_reply', 1);
     $criteria->order = 'id DESC';
     $criteria->limit = 5;
     $feedbacks = Feedback::model()->findAll($criteria);
     $criteria = new CDbCriteria();
     $criteria->compare('t.banner_position_id', 4);
     $banner = Banner::model()->localized()->find($criteria);
     $this->layout = 'main';
     $feedbackForm = new FeedbackForm();
     if (isset($_POST['FeedbackForm'])) {
         $feedbackForm->setAttributes($_POST['FeedbackForm']);
         if ($feedbackForm->submit()) {
             $this->redirect(array('success'));
         }
     }
     $this->render('index', array('feedbacks' => $feedbacks, 'feedbackForm' => $feedbackForm, 'banner' => $banner));
 }
 public function actionCopy()
 {
     exit;
     Yii::import('feedback.models.*');
     $questions = Feedback::model()->faq()->findAll(array('order' => 't.id ASC'));
     foreach ($questions as $key => $q) {
         $question = new FaqQuestion();
         $question->id = $q->id;
         $question->category_id = $q->group_id;
         $question->created_at = $q->creation_date;
         $question->updated_at = $q->change_date;
         $question->question = $q->text;
         $question->answer = $q->answer;
         $question->sort = $q->sort * 10;
         $question->status = $q->status > 0 ? FaqQuestion::STATUS_PUBLISHED : FaqQuestion::STATUS_DRAFT;
         if (!$question->save()) {
             echo $question->question . ' - error<br />';
             var_dump($question->getErrors());
             echo '<hr>';
         }
     }
 }
Esempio n. 16
0
        font-weight: 600;
    }
</style>

<script>
    $(document).ready(function () {
        totalUsers = "<?php 
echo User::model()->count();
?>
";
        totalPosts = "<?php 
echo Post::model()->count();
?>
";
        totalFeedbacks = "<?php 
echo Feedback::model()->count();
?>
";
        totalAdvertisements = "<?php 
echo Advertisement::model()->count();
?>
";
        countUp(totalUsers, '.count1');
        countUp(totalPosts, '.count2');
        countUp(totalFeedbacks, '.count3');
        countUp(totalAdvertisements, '.count4');
    });

    function countUp(count, className)
    {
        var div_by = Math.round(count / 100),
Esempio n. 17
0
<?php

$this->breadcrumbs = array('系统信息');
?>

<?php 
echo TbHtml::well('概况', array('size' => TbHtml::WELL_SIZE_SMALL));
?>
<p><strong>未读信息</strong></p>
<p>留言反馈:
    <?php 
echo CHtml::link(Feedback::model()->count(array('condition' => "status='1'")), array('feedback/admin'));
?>
     短信息:
    <?php 
echo CHtml::link(Message::model()->count(array('condition' => "status='1'")), array('message/index'));
?>
</p>


<?php 
echo TbHtml::well('服务器信息', array('size' => TbHtml::WELL_SIZE_SMALL));
?>

<p>系统版本 : <?php 
echo Fircms::VERSION;
?>
</p>
<p>操作系统 : <?php 
echo PHP_OS;
?>
Esempio n. 18
0
                                    form.parent(".box").html(response.data).addClass("success");
                                }
                                else {
                                    for(key in response) {
                                        $("#" + key).next(".errorMessage").html(response[key]).show();
                                    }
                                    $("#feedback-refresh-captcha").trigger("click");
                                }
                            }
                        });
                    }
                }']]);
?>
        <div class="form-group">
            <?php 
echo $form->dropDownList($model, 'category_id', Feedback::model()->categoryList, ['class' => 'form-control', 'empty' => Yii::t('FeedbackModule.feedback', 'Choose the message category')]);
?>
            <?php 
echo $form->error($model, 'category_id');
?>
        </div><!-- /.form-group -->

        <div class="form-group">
            <?php 
echo $form->textField($model, 'name', ['class' => 'form-control', 'placeholder' => $model->getAttributeLabel('name')]);
?>
            <?php 
echo $form->error($model, 'name');
?>
        </div><!-- /.form-group -->
 /**
  * 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 int $id - record value
  *
  * @return Feedback $model
  *
  * @throws CHttpException
  */
 public function loadModel($id = null)
 {
     if ($this->_model === null) {
         $id = $id ?: Yii::app()->getRequest()->getParam('id');
         if (($this->_model = Feedback::model()->findByPk($id)) === null) {
             throw new CHttpException(404, Yii::t('FeedbackModule.feedback', 'Requested page was not found!'));
         }
     }
     return $this->_model;
 }
Esempio n. 20
0
 /**
  * Метод перед удалением:
  * 
  * @return void
  */
 public function beforeDelete()
 {
     if (User::model()->admin()->count() === 1 && $this->_oldRole === User::getSuperuserRole()) {
         $this->addError('role', Yii::t('UserModule.user', 'You can\'t make this changes!'));
         return false;
     }
     // убираем связь удаленного пользователя с ролью
     //$auth = Yii::app()->authManager;
     //$auth->revoke($this->role, $this->id);
     //$auth->save();
     // Удаляем токены
     foreach ($this->tokens as $token) {
         $token->delete();
     }
     // Обнуляем связанные элементы обратной связи
     Yii::import("application.modules.feedback.models.Feedback");
     foreach (Feedback::model()->findAllByAttributes(array('user_id' => $this->id)) as $item) {
         $item->user_id = null;
         $item->save(false, array('user_id'));
     }
     // Обнуляем связанные подписки
     Yii::import("application.modules.subscription.models.Subscription");
     foreach (Subscription::model()->findAllByAttributes(array('user_id' => $this->id)) as $item) {
         $item->user_id = null;
         $item->save(false, array('user_id'));
     }
     // Обнуляем связанные результаты голосования
     Yii::import("application.modules.poll.models.*");
     foreach (Result::model()->findAllByAttributes(array('user_id' => $this->id)) as $item) {
         $item->user_id = null;
         $item->save(false, array('user_id'));
     }
     // Удаляем интересные мысли пользователя
     Yii::import("application.modules.classroom.models.Quote");
     Quote::model()->deleteAllByAttributes(array('user_id' => $this->id));
     // Удаляем последние прочитанные страницы пользователя
     Yii::import("application.modules.classroom.models.LastReadPage");
     LastReadPage::model()->deleteAllByAttributes(array('user_id' => $this->id));
     // Удаляем настройки пользователя
     foreach (yupe\models\Settings::model()->findAllByAttributes(array('user_id' => $this->id)) as $item) {
         $item->delete();
     }
     // Удаляем профиль
     $this->profile->delete();
     return parent::beforeDelete();
 }
Esempio n. 21
0
<legend><?php 
echo Yii::t("Bootstrap", "LIST.Feedback");
?>
</legend>

<?php 
$assetsDir = Yii::app()->basePath;
$labels = Feedback::model()->attributeLabels();
$this->widget('bootstrap.widgets.TbExtendedGridView', array('id' => 'feedback-grid', 'template' => "{items}\n{pager}", 'enableHistory' => true, 'dataProvider' => $model->search(), 'filter' => null, 'bulkActions' => array('actionButtons' => $this->bulkRemoveButton(), 'checkBoxColumnConfig' => array('name' => 'id')), 'columns' => array(array('header' => $labels["id"], 'name' => "id"), array('header' => $labels["fio"], 'name' => "fio"), array('header' => $labels["phone"], 'name' => "phone"), array('header' => $labels["email"], 'name' => "email"), array('header' => $labels["status"], 'name' => "status", 'value' => 'Feedback::model()->getStatus($data->status)'), array('header' => $labels["created_at"], 'name' => "created_at"), array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{update}  {delete}', 'buttons' => array('update' => array('label' => yii::t('Bootstrap', 'PHRASE.UPDATE'), 'url' => 'CHtml::normalizeUrl(array("update", "id" => $data->id))', 'options' => array()), 'delete' => array('label' => yii::t('Bootstrap', 'PHRASE.DELETE'), 'options' => array())), 'htmlOptions' => array('style' => 'white-space: nowrap')))));
Esempio n. 22
0
 public function actionUpdateSortOrder()
 {
     if (Yii::app()->user->checkAccess('updateFeedback') == false) {
         throw new CHttpException(403);
     }
     if (Yii::app()->request->isAJAXRequest) {
         $id = Yii::app()->request->getQuery('id');
         $sortOrder = Yii::app()->request->getQuery('sort_order');
         $feedback = Feedback::model()->findByPk($id);
         if (is_null($feedback) == false) {
             $feedback->sort_order = $sortOrder;
             $feedback->save();
         }
     }
 }
 public function feedbacks($post)
 {
     $message = $post['feedbackmessage'];
     $contractor_id = $post['contractor_id'];
     $homeowner_id = $post['homeowner_id'];
     $date_posted = date("Y-m-d H:i:s");
     $feedback = new Feedback();
     $feedback->contractor_id = $contractor_id;
     $feedback->homeowner_id = $homeowner_id;
     $feedback->date_posted = $date_posted;
     $feedback->message = $message;
     $feedback->save();
     $return = $htmlParams = array();
     $criteria = new CDbCriteria();
     $criteria->condition = "contractor_id = '{$contractor_id}'";
     $htmlParams['feedback'] = Feedback::model()->findAll($criteria);
     $return['html'] = $this->renderPartial('feedbacksupdate', $htmlParams, true);
     $this->renderJSON($return, true);
 }
Esempio n. 24
0
?>
 input ').rating();
</script>
<div  id="rating_info_<?php 
echo $id;
?>
">
<?php 
if ($rating = FeedbackRating::model()->findByAttributes(array('feedback_id' => $id))) {
    echo "Rating: <strong>" . $rating->vote_average . "</strong>";
    echo " " . $rating->vote_count . " votes";
    $current_rating = $rating->vote_average;
} else {
    $current_rating = 0;
}
$feedback = Feedback::model()->findByPk($id);
?>
        </div>

<?php 
if (isset($update)) {
    $cs = Yii::app()->clientScript;
    $cs->scriptMap = array('jquery.js' => false, 'jquery.rating.js' => false, 'jquery.metadata.js' => false);
} elseif ($loop > 0) {
    $cs = Yii::app()->clientScript;
    $cs->scriptMap = array('jquery.js' => false, 'jquery.rating.js' => false, 'jquery.metadata.js' => false);
}
// rating
$readonly = false;
if ($feedback->homeowner_id == Yii::app()->user->getId()) {
    $readonly = true;
 public function actionProfile()
 {
     $username = Yii::app()->Ini->v('user');
     $profile_details = Contractors::model()->findByAttributes(array('Username' => $username));
     $current_userid = Yii::app()->user->getId();
     $con_id = $profile_details->ContractorId;
     $criteria = new CDbCriteria();
     $criteria->condition = "contractor_id = '{$con_id}'";
     $feedback = Feedback::model()->findAll($criteria);
     $criteria_social = new CDbCriteria();
     $criteria_social->condition = "contractor_id = '{$con_id}'";
     $social_accounts = ContractorSocials::model()->findAll($criteria_social);
     $contractor_license = ContractorLicense::model()->findByAttributes(array('contractor_id' => $con_id));
     $contractor_bond = ContractorBond::model()->findByAttributes(array('contractor_id' => $con_id));
     $contractor_points = Contractors::model()->updatePoints($con_id);
     $team_members = new CDbCriteria();
     $team_members->condition = "contractor_id = '{$con_id}' AND confirmed = '1' ORDER BY RAND() LIMIT 0,5";
     $contractor_team = ContractorTeam::model()->findAll($team_members);
     if (count($profile_details) > 0) {
         $profile_details->updatePoints($profile_details->ContractorId);
         $contractor_id = $con_id;
         $company = $profile_details->Name;
         $contact_name = $profile_details->ContactName;
         $phone = $profile_details->Phone;
         $fax = $profile_details->Fax;
         $address1 = $profile_details->Address1;
         $address2 = $profile_details->Address2;
         $city = $profile_details->City;
         $state = $profile_details->State;
         $zipcode = $profile_details->Zip;
         $email = $profile_details->Email;
         $website = $profile_details->Website;
         $about = $profile_details->AboutBusiness;
         $services = $profile_details->Services;
         $date_created = $profile_details->Created;
         $username = $profile_details->Username;
         $project_type = $this->getProjectTypeName($profile_details->ProjectTypeId);
         $photo_cover = $this->getProfileCover($profile_details->ContractorId);
         $is_my_profile = false;
         $homeowner_projects = array();
         if (!Yii::app()->user->isGuest) {
             if ($contractor_id == $current_userid) {
                 $is_my_profile = true;
             } else {
                 /*
                 	if homeowner
                 	can send message and attach project
                 */
                 if (Yii::app()->user->role == 'homeowner') {
                     $criteria = new CDbCriteria();
                     $criteria->condition = "homeowner_id = " . $current_userid;
                     $homeowner_projects = Projects::model()->findAll($criteria);
                 }
             }
         }
         //get map location
         $address = urlencode($address1 . ',' . $city . ',' . $state . "," . $zipcode . ",USA");
         $l = explode(",", Yii::app()->Ini->GetMapLocation($address));
         $point = array($address1 . ',' . $city . ',' . $state, floatval($l[0]), floatval($l[1]), 0);
         $this->pageTitle = 'Handyman.com - Contractor - ' . $company . ' Profile';
         $this->render('contractor-profile', array('profile_exists' => true, 'contractor_id' => $contractor_id, 'company' => $company, 'contact_name' => $contact_name, 'phone' => $phone, 'fax' => $fax, 'address1' => $address1, 'address2' => $address2, 'city' => $city, 'state' => $state, 'zipcode' => $zipcode, 'email' => $email, 'website' => $website, 'about' => $about, 'services' => $services, 'date_created' => date('F j, Y', strtotime($date_created)), 'username' => $username, 'project_type' => $project_type, 'page' => 'profile', 'param' => "", 'logo' => $this->getContractorProfilePic($profile_details->ContractorId), 'is_my_profile' => $is_my_profile, 'contractor_license' => $contractor_license, 'contractor_bond' => $contractor_bond, 'social_accounts' => $social_accounts, 'contractor_points' => $contractor_points, 'feedback' => $feedback, 'photo_cover' => $photo_cover, 'my_gallery' => Contractorphotos::model()->findAllByAttributes(array('contractor_id' => $contractor_id, 'is_profile' => '0'), array('limit' => '6', 'order' => 'RAND()')), 'homeowner_projects' => $homeowner_projects, 'point' => $point, 'contractor_team' => $contractor_team, 'map_location' => $l));
         //update views
         if (!Yii::app()->user->isGuest) {
             $userid = Yii::app()->user->getId();
             $role = Yii::app()->user->role;
             $views = ContractorViews::model()->findByAttributes(array('viewed_by' => $userid, 'contractor_id' => $contractor_id, 'viewed_user_type' => $role));
             if (count($views) > 0) {
             } else {
                 $views = new ContractorViews();
                 $views->contractor_id = $contractor_id;
                 $views->viewed_by = $userid;
                 $views->viewed_user_type = $role;
                 $views->save();
             }
         }
     } else {
         $this->redirect(Yii::app()->homeUrl . 'home/error');
     }
 }
 public function run()
 {
     $dataProvider = new CActiveDataProvider('Feedback', ['sort' => ['defaultOrder' => 'id DESC'], 'pagination' => ['pageSize' => (int) $this->limit]]);
     $cacheTime = Yii::app()->controller->yupe->coreCacheTime;
     $this->render('panel-feedback-stat', ['feedbackCount' => Feedback::model()->cache($cacheTime)->count('create_time >= :time', [':time' => time() - 24 * 60 * 60]), 'allFeedbackCount' => Feedback::model()->cache($cacheTime)->count(), 'needAnswerCount' => Feedback::model()->new()->cache($cacheTime)->count(), 'dataProvider' => $dataProvider]);
 }
 public function actionMy_profile()
 {
     if (!Yii::app()->user->isGuest) {
         if (Yii::app()->user->role == 'contractor') {
             $contractor_id = Yii::app()->user->getId();
             $profile_details = Contractors::model()->findByAttributes(array('ContractorId' => $contractor_id));
             $criteria = new CDbCriteria();
             $criteria->condition = "contractor_id = '{$contractor_id}'";
             $feedback = Feedback::model()->findAll($criteria);
             $criteria_social = new CDbCriteria();
             $criteria_social->condition = "contractor_id = '{$contractor_id}'";
             $social_accounts = ContractorSocials::model()->findAll($criteria_social);
             $contractor_license = ContractorLicense::model()->findByAttributes(array('contractor_id' => $contractor_id));
             $contractor_bond = ContractorBond::model()->findByAttributes(array('contractor_id' => $contractor_id));
             $contractor_points = Contractors::model()->updatePoints($contractor_id);
             $team_members = new CDbCriteria();
             $team_members->condition = "contractor_id = '{$contractor_id}' AND confirmed = '1' ORDER BY RAND() LIMIT 0,5";
             $contractor_team = ContractorTeam::model()->findAll($team_members);
             if (count($profile_details) > 0) {
                 $company = $profile_details->Name;
                 $contact_name = $profile_details->ContactName;
                 $phone = $profile_details->Phone;
                 $fax = $profile_details->Fax;
                 $address1 = $profile_details->Address1;
                 $address2 = $profile_details->Address2;
                 $city = $profile_details->City;
                 $state = $profile_details->State;
                 $zipcode = $profile_details->Zip;
                 $email = $profile_details->Email;
                 $website = $profile_details->Website;
                 $about = $profile_details->AboutBusiness;
                 $services = $profile_details->Services;
                 $date_created = $profile_details->Created;
                 $username = $profile_details->Username;
                 $project_type = $this->getProjectTypeName($profile_details->ProjectTypeId);
                 $profile_pic = $this->getContractorProfilePic($contractor_id);
                 $current_userid = $profile_details->ContractorId;
                 $photo_cover = $this->getProfileCover($contractor_id);
             }
             $this->pageTitle = 'Handyman.com - ' . $contact_name . ' Profile';
             $is_my_profile = false;
             if ($contractor_id == $current_userid) {
                 $is_my_profile = true;
             }
             $this->render('my-profile', array('company' => $company, 'contact_name' => $contact_name, 'phone' => $phone, 'address1' => $address1, 'address2' => $address2, 'city' => $city, 'state' => $state, 'zipcode' => $zipcode, 'email' => $email, 'website' => $website, 'about' => $about, 'services' => $services, 'date_created' => date('F j, Y', strtotime($date_created)), 'username' => $username, 'project_type' => $project_type, 'page' => 'profile', 'param' => "", 'profile_pic' => $profile_pic, 'feedback' => $feedback, 'is_my_profile' => $is_my_profile, 'contractor_license' => $contractor_license, 'contractor_bond' => $contractor_bond, 'social_accounts' => $social_accounts, 'contractor_points' => $contractor_points, 'photo_cover' => $photo_cover, 'contractor_team' => $contractor_team, 'my_gallery' => Contractorphotos::model()->findAllByAttributes(array('contractor_id' => $contractor_id, 'is_profile' => '0'), array('limit' => '6'))));
         } else {
             $this->redirect(Yii::app()->homeUrl);
         }
     } else {
         $this->redirect(Yii::app()->homeUrl);
     }
 }
Esempio n. 28
0
			<?php 
    foreach ($feedback as $k => $v) {
        ?>
			<input type="hidden" id="contractor_id" value="<?php 
        echo $v->contractor_id;
        ?>
"/>
			<div class="row" id="feedback_<?php 
        echo $v->feedback_id;
        ?>
">
				<div class="col-lg-3">
					<div class="row user-rvws">
						<div class="col-lg-12 col-xs-3">
						<?php 
        $fmodel = Feedback::model()->findByPk($v->feedback_id);
        if ($fmodel->homeowner->photo == "") {
            ?>
							<img src="http://d3flf7kkefqaeh.cloudfront.net/_assets/128x128_no_pht.png" class="img-circle" alt="default reviewer logo">
						<?php 
        } else {
            ?>
							<img src="<?php 
            echo Yii::app()->request->baseUrl . '/uploads/homeowner/' . $fmodel->homeowner->photo;
            ?>
" class="img-circle" alt="default reviewer logo">
						<?php 
        }
        ?>
						</div>
						<div class="col-lg-12 col-xs-9">
 /**
  * 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 int $id - record value
  *
  * @return Feedback $model
  *
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     if (($model = Feedback::model()->findByPk($id)) === null) {
         throw new CHttpException(404, Yii::t('FeedbackModule.feedback', 'Requested page was not found!'));
     }
     return $model;
 }
 public function actionReply($id)
 {
     $model = $this->loadModel($id);
     $model->scenario = 'replyFeedback';
     if (isset($_POST['Manager'])) {
         $managerPhone = isset($_POST['Manager']['phone']) ? $_POST['Manager']['phone'] : NULL;
         $model->template = isset($_POST['Feedback']['template']) ? $_POST['Feedback']['template'] : NULL;
         if (isset($_POST['Feedback']['variables'])) {
             foreach ($_POST['Feedback']['variables'] as $key => $var) {
                 $model->variables[$key] = isset($_POST['Feedback']['variables'][$key]) ? strip_tags($_POST['Feedback']['variables'][$key]) : NULL;
             }
         }
         if ($model->validate('template', 'variables')) {
             $modelEmailTemplate = EmailTemplate::model()->findByPK($model->template);
             if ($modelEmailTemplate !== NULL) {
                 $manager = User::model()->find(Yii::app()->user->id);
                 $managerName = $manager->first_name . ' ' . $manager->last_name;
                 $managerEmail = $manager->email;
                 $clientEmail = $model->email;
                 $final_array = Yii::app()->extraFunctions->emailSendArray($modelEmailTemplate->description, $model->variables);
                 //replace varibles
                 if (!empty($managerPhone)) {
                     $appendContent = '<br/><p>Nếu quý khách cần tư vấn trực tiếp, vui lòng liên lạc qua số điện thoại:<strong> ' . $managerPhone . '</strong></p>';
                     $final_array .= $appendContent;
                 }
                 $send_mail_data = array('subject' => $modelEmailTemplate->subject, 'firstName' => ucwords($model->name), 'content' => $final_array);
                 $message = $this->renderPartial('//site/_emailTemplate', $send_mail_data, true);
                 //call a template view
                 $result = Yii::app()->extraFunctions->sendEmail($clientEmail, $modelEmailTemplate->subject, $message, $model->name, $managerEmail);
                 //send mail
                 if ($result) {
                     Feedback::model()->updateStatus($id, 0);
                 }
             } else {
                 Yii::app()->user->setFlash('error', Yii::t('backend', 'Your request failed. Please contact administrators.'));
             }
             $this->redirect(array('/' . backend . '/feedback/reply', 'id' => $id));
         }
     }
     $this->render(strtolower($this->action->id), array('model' => $model));
 }