Example #1
0
 public function run()
 {
     $id = Yii::app()->request->getParam('id');
     $name = Yii::app()->request->getParam('name');
     $email = Yii::app()->request->getParam('email');
     $phone = Yii::app()->request->getParam('phone');
     $website = Yii::app()->request->getParam('website');
     $logo = Yii::app()->request->getParam('logo');
     $background = Yii::app()->request->getParam('background');
     $location = Yii::app()->request->getParam('location');
     $hub = Yii::app()->request->getParam('hub');
     $service = Yii::app()->request->getParam('service');
     $facebook = Yii::app()->request->getParam('facebook');
     $linkedin = Yii::app()->request->getParam('linkedin');
     $introduction = Yii::app()->request->getParam('content');
     $data = array('name' => $name, 'email' => $email, 'phone' => $phone, 'website' => $website, 'logo' => $logo, 'background' => $background, 'location' => $location, 'hubId' => $hub, 'serviceid' => $service, 'facebookid' => $facebook, 'linkedinid' => $linkedin, 'introduction' => $introduction);
     $proxy = new BCompany();
     $dp = new BHub();
     $dc = Service::model()->findAll('status!=0');
     if (Yii::app()->request->isAjaxRequest) {
         $result = $proxy->updateCompany($data, $id);
         echo CJSON::encode($result);
     } else {
         $result = $proxy->getCompanyInfo($id);
         $hub = $dp->getHubList($start, 10);
         if ($result['code'] == 200) {
             $this->controller->render('edit', array('data' => $result['data'], 'hub' => $hub['data'], 'service' => $dc));
         } else {
             throw new CHttpException($result['code'], $result['message']);
         }
     }
 }
Example #2
0
 public static function getOrganName()
 {
     $organName = Yii::app()->user->getState('organName');
     if ($organName) {
         return $organName;
     }
     //先获取角色身份(生产商/经销商/修理厂)
     $organName = "";
     // $userid = Yii::app()->user->id;
     $userid = Commonmodel::getOrganID();
     $model = self::getIdentity($userid);
     if ($model['identity'] == 1) {
         $organ = MakeOrgan::model()->find('userID=:userid', array(':userid' => $userid));
         $organName = $organ['name'];
     } else {
         if ($model['identity'] == 2) {
             $organ = Dealer::model()->find('userID=:userid', array(':userid' => $userid));
             $organName = $organ['organName'];
         } else {
             if ($model['identity'] == 3) {
                 $organ = Service::model()->find('userId=:userid', array(':userid' => $userid));
                 $organName = $organ['serviceName'];
             }
         }
     }
     Yii::app()->user->setState('organName', $organName);
     return $organName;
 }
 public function loadModel($id)
 {
     if (($model = Service::model()->findByPk($id)) === null) {
         throw new CHttpException(404, 'Страница не найдена');
     }
     return $model;
 }
Example #4
0
 public function run()
 {
     $start = Yii::app()->request->getParam('start');
     $dp = new BHub();
     $dc = Service::model()->findAll('status!=0');
     $hub = $dp->getHubList($start, 10);
     $this->controller->render('edit', array('hub' => $hub['data'], 'service' => $dc));
 }
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     $this->_operate($model, 'update');
     $listGames = Games::model()->findAll();
     $listService = Service::model()->findAll();
     $this->render('update', array('model' => $model, 'listGames' => $listGames, 'listService' => $listService));
 }
 public function actionShow($alias)
 {
     $model = Service::model()->published()->with(array('slides' => array('scopes' => 'published', 'order' => 'slides.sort ASC')))->findByAlias($alias);
     if (!$model) {
         throw new CHttpException(404);
     }
     $this->render('show', array('model' => $model));
 }
 public function run()
 {
     $models = Service::model()->published()->findAll(array('order' => 't.sort ASC'));
     if (empty($models)) {
         return;
     }
     $this->render($this->view, array('models' => $models));
 }
 public static function getAvailableServices()
 {
     $services = Service::model()->findAll("type <> '{ServiceHelper::TYPE_SMALL_BUSINESS}'");
     $result = array(null => 'Отсутствует');
     foreach ($services as $service) {
         $result[$service->id] = $service->title;
     }
     return $result;
 }
Example #9
0
 public function actionSave()
 {
     $services = Service::model()->findAllByAttributes(['status' => 0]);
     foreach ($services as $service) {
         $traffic = new Traffic();
         $traffic->attributes = ['uid' => $service->uid, 'email' => $service->email, 'date' => date('Y-m-d', strtotime('yesterday')), 'traffic' => $service->used];
         $traffic->save();
     }
     echo "Success";
 }
Example #10
0
 public function traffic()
 {
     $traffic = Service::model()->sum('traffic');
     $serv1 = Service::model()->findByPk(1);
     $serv2 = Service::model()->findByPk(2);
     $traffic -= $serv1->traffic + $serv2->traffic;
     $used = Service::model()->sum('left');
     $left = $traffic - $used;
     $this->response(200, 'success', [['name' => '收益', 'value' => ['总额' => round($traffic / 100 / 1024 * 0.8, 2), '销售' => round($used / 100 / 1024 * 0.8, 2), '库存' => round($left / 100 / 1024 * 0.8, 2)]], ['name' => '已使用', 'value' => $used / 100], ['name' => '未使用', 'value' => $left / 100]]);
 }
Example #11
0
 public function run($id)
 {
     $community = new CCommunity();
     $result = $community->getCompanyListByService($id);
     $title = Service::model()->findByAttributes(array('id' => $id))->name;
     $this->controller->pageTitle = $title;
     if ($result['code'] == 200) {
         $this->controller->bodyCss = 'whitecolor';
         $this->controller->render('servicescompany', array('list' => $result['data']));
     }
 }
Example #12
0
 public function actionDetail($alias)
 {
     $model = $this->loadModelByPKID($alias);
     $this->pageTitle = 'List of Service with type: ' . $model->s_name;
     $models = Service::model()->findAll('s_service_type_id = :s_service_type_id and s_store_id = :s_store_id', array(':s_service_type_id' => $model->pk_s_id, ':s_store_id' => $model->s_store_id));
     if (Yii::app()->request->isAjaxRequest) {
         $this->renderPartial($this->view . 'detail', array('model' => $model, 'models' => $models));
     } else {
         $this->render($this->view . 'detail', array('model' => $model, 'models' => $models));
     }
 }
 public static function getAvailableServices()
 {
     $criteria = new CDbCriteria();
     $criteria->addCondition("type <> '{ServiceHelper::TYPE_SMALL_BUSINESS}'");
     $criteria->order = 'title ASC';
     $services = Service::model()->findAll($criteria);
     $res = array(null => 'Отсутствует');
     foreach ($services as $service) {
         $res[$service->id] = $service->title;
     }
     return $res;
 }
 public function actionIndex($alias = '')
 {
     // Загружаем страницу "Услуги"
     Yii::import("application.modules.page.models.Page");
     $page = Page::model()->with(array('slides' => array('scopes' => 'published')))->findByPath("services");
     // Список услуг
     $criteria = new CDbCriteria();
     $criteria->order = 't.sort ASC';
     $models = Service::model()->published()->findAll($criteria);
     // Вывод в шаблон
     $this->render('index', array('models' => $models, 'page' => $page));
 }
Example #15
0
 public function run()
 {
     $query = $this->request->getQuery('Service', []);
     $model = Service::model();
     $model->attributes = $query;
     $condition = $this->createSearchCriteria($query);
     $pager = new CPagination($model->count($condition));
     $pager->setPageSize(20);
     $condition['offset'] = $pager->getOffset();
     $condition['limit'] = $pager->getLimit();
     $condition['order'] = 'status asc, uid asc';
     $data = $model->findAll($condition);
     $this->render('pac', ['data' => new RedArrayDataProvider($data), 'pager' => $pager, 'model' => $model]);
 }
 public function getSurveySteps()
 {
     if (!empty($this->surveySteps)) {
         $steps = Service::model()->findAllByPk($this->surveySteps);
     } else {
         $condition = array();
         if (!empty($this->selectedSurveySteps)) {
             $condition[] = 'id IN (' . implode(',', $this->selectedSurveySteps) . ')';
         }
         $steps = Service::model()->findAll(implode(" OR ", $condition));
     }
     $steps = $this->setCounts($steps);
     return $steps;
 }
Example #17
0
 public function actionDelete($id)
 {
     $service = Service::model()->findAll('contractor_id=' . $id);
     if ($service) {
         foreach ($service as $serv) {
             WrapServTransport::Del($serv->id);
             ServCulture::model()->deleteAllByAttributes(array('service_id' => $serv->id));
             $food = ServFood::model()->findAll('service_id=' . $serv->id);
             if ($food) {
                 foreach ($food as $mFood) {
                     LinkFoodServ::model()->deleteAllByAttributes(array('serv_food_id' => $mFood->id));
                 }
             }
             ServFood::model()->deleteAllByAttributes(array('service_id' => $serv->id));
             ServIntensiv::model()->deleteAllByAttributes(array('service_id' => $serv->id));
             ServOther::model()->deleteAllByAttributes(array('service_id' => $serv->id));
             $personal = ServPersonal::model()->findAll('service_id=' . $serv->id);
             if ($personal) {
                 foreach ($personal as $mPers) {
                     LinkPersonalLanguage::model()->deleteAllByAttributes(array('serv_personal_id' => $mPers->id));
                 }
             }
             ServPersonal::model()->deleteAllByAttributes(array('service_id' => $serv->id));
             ServPlatform::model()->deleteAllByAttributes(array('service_id' => $serv->id));
             ServProgram::model()->deleteAllByAttributes(array('service_id' => $serv->id));
             ServTicket::model()->deleteAllByAttributes(array('service_id' => $serv->id));
             $live = ServLive::model()->findAll('service_id=' . $serv->id);
             if ($live) {
                 foreach ($live as $mLive) {
                     ServLiveRoom::model()->deleteAllByAttributes(array('serv_live_id' => $mLive->id));
                 }
             }
             ServLive::model()->deleteAllByAttributes(array('service_id' => $serv->id));
             Photo::model()->deleteAllByAttributes(array('service_id' => $serv->id));
         }
     }
     Service::model()->deleteAllByAttributes(array('contractor_id' => $id));
     Comment::model()->deleteAllByAttributes(array('contractor_id' => $id));
     LinkCityContractor::model()->deleteAllByAttributes(array('contractor_id' => $id));
     Contractor::model()->deleteByPk($id);
     echo "ok";
 }
Example #18
0
    protected function beforeAction($action)
    {
        //echo Yii::app()->request->csrfToken;
        Yii::app()->clientScript->registerScript('ajax-csrf', '
			$.ajaxPrefilter(function(options, originalOptions, jqXHR){
				if(originalOptions.type){
					var type = originalOptions.type.toLowerCase();
				} else {
					var type = "";
				}

				if(type == "post" && typeof originalOptions.data === "object"){
					options.data = $.extend(originalOptions.data, { "' . Yii::app()->request->csrfTokenName . '": "' . Yii::app()->request->csrfToken . '" });
					options.data = $.param(options.data);
				}
			});
		', CClientScript::POS_END, array());
        if (!Yii::app()->user->checkAccess('backend_access')) {
            $currentController = Yii::app()->controller->id;
            $currentAction = Yii::app()->controller->action->id;
            if (!($currentController == 'site' && ($currentAction == 'login' || $currentAction == 'logout'))) {
                if (issetModule('service')) {
                    $serviceInfo = Service::model()->findByPk(Service::SERVICE_ID);
                    if ($serviceInfo && $serviceInfo->is_offline == 1) {
                        $allowIps = explode(',', $serviceInfo->allow_ip);
                        $allowIps = array_map("trim", $allowIps);
                        if (!in_array(Yii::app()->request->userHostAddress, $allowIps)) {
                            $this->renderPartial('//modules/service/views/index', array('page' => $serviceInfo->page), false, true);
                            Yii::app()->end();
                        }
                    }
                }
            }
        }
        /* start  get page banners */
        if (issetModule('advertising') && !param('useBootstrap')) {
            $advert = new Advert();
            $advert->getAdvertContent();
        }
        /* end  get page banners */
        return parent::beforeAction($action);
    }
Example #19
0
 public function run($id = null, $page = 1, $size = 2)
 {
     $this->controller->pageTitle = "Company";
     if (Yii::app()->request->isAjaxRequest) {
         if (!$id) {
             $id = User::model()->findByAttributes(array('id' => Yii::app()->user->id))->company;
         }
         $post = new CPost();
         $result = $post->getCompanyList($id, $page, $size);
         echo CJSON::encode(array('code' => 200, 'mes' => 'success', 'data' => array('list' => $result['data'])));
     } else {
         if ($id) {
             $company = Company::model()->findByAttributes(array('id' => $id));
             $service = Service_company::model()->findAllByAttributes(array('companyId' => $id, 'status' => 1));
             if ($service) {
                 foreach ($service as $list) {
                     $servicelist[] = Service::model()->findByAttributes(array('id' => $list['serviceId']));
                 }
             }
             $hub = Hub::model()->findByAttributes(array('id' => $company['location']));
             $post = new CPost();
             $postlist = $post->getCompanyList($id, $page, $size);
             //取出公司所有成员
             $member = User::model()->findAllByAttributes(array('company' => $id));
         } else {
             $user = User::model()->findByAttributes(array('id' => Yii::app()->user->id));
             $company = Company::model()->findByAttributes(array('id' => $user['company']));
             $service = Service_company::model()->findAllByAttributes(array('companyId' => $company['id'], 'status' => 1));
             if ($service) {
                 foreach ($service as $list) {
                     $servicelist[] = Service::model()->findByAttributes(array('id' => $list['serviceId']));
                 }
             }
             $hub = Hub::model()->findByAttributes(array('id' => $company['location']));
             $post = new CPost();
             $postlist = $post->getCompanyList($company->id, $page, $size);
             $member = User::model()->findAllByAttributes(array('company' => $user['company']));
         }
         // print_r($company);die;
         $this->controller->render('profile', array('company' => $company, 'service' => $servicelist, 'location' => $hub['location'], 'postlist' => $postlist['data'], 'member' => $member));
     }
 }
Example #20
0
 public function run()
 {
     $uid = $this->request->getQuery('id', 0);
     $service = Service::model()->findByPk($uid);
     if (!empty($service)) {
         if (in_array($service->status, [1, 2])) {
             // 不可用状态
             $task = Queue::createTask($this->app->createUrl('api/open'), $uid);
         } else {
             $task = Queue::createTask($this->app->createUrl('api/close'), $uid);
         }
         if (Queue::enqueue($task)) {
             $this->response(200, ':) success');
         } else {
             $this->response(200, ':( failure');
         }
     } else {
         $this->response(404, 'Not Found');
     }
 }
Example #21
0
 public function run()
 {
     $uid = $this->request->getQuery('uid', false);
     if ($uid) {
         $this->render('purchase', ['uid' => $uid]);
     } else {
         $uid = $this->request->getPost('uid', 0);
         $traffic = $this->request->getPost('traffic', 0);
         $service = Service::model()->findByPk($uid);
         if (!empty($service) && is_numeric($traffic)) {
             $service->traffic += $traffic * 100;
             if ($service->save()) {
                 $this->response(200, ':) Success');
             } else {
                 $this->response(500, ':( failed');
             }
         } else {
             $this->response(404, 'Not Found!');
         }
     }
 }
Example #22
0
 public static function getRecommendByPhone($recommend)
 {
     $model = Dealer::model()->find("Phone=:phone", array(":phone" => $recommend))->attributes['userID'];
     if (empty($model)) {
         unset($model);
         $model = Service::model()->find("serviceCellPhone=:cellphone", array(":cellphone" => $recommend))->attributes['userId'];
     }
     return $model;
 }
echo $form->errorSummary($rule);
?>
	<?php 
echo $form->dropDownList($rule, 'parent_rule_id', CHtml::listData(OphTrOperationbooking_Waiting_List_Contact_Rule::model()->getListAsTree(), 'id', 'treeName'), array('empty' => '- None -'));
?>
	<?php 
echo $form->textField($rule, 'rule_order', array(), array(), array('field' => 2));
?>
	<?php 
echo $form->dropDownList($rule, 'site_id', Site::model()->getListForCurrentInstitution('name'), array('empty' => '- Not set -'));
?>
	<?php 
echo $form->dropDownList($rule, 'firm_id', Firm::model()->getListWithSpecialties(), array('empty' => '- Not set -'));
?>
	<?php 
echo $form->dropDownList($rule, 'service_id', CHtml::listData(Service::model()->findAll(array('order' => 'name')), 'id', 'name'), array('empty' => '- Not set -'));
?>
	<?php 
echo $form->textField($rule, 'name');
?>
	<?php 
echo $form->textField($rule, 'telephone', array(), array(), array('field' => 3));
?>
	<?php 
if ($rule->children) {
    ?>
		<div class="row field-row">
			<div class="large-<?php 
    echo $form->layoutColumns['label'];
    ?>
 column">
Example #24
0
 public function actionOrgan()
 {
     $user_id = Commonmodel::getOrganID();
     // $ids = $user_id;
     $businessContacts = BusinessContacts::model()->findAll('user_id=:user_id and Status=0', array(':user_id' => $user_id));
     foreach ($businessContacts as $key => $val) {
         if ($val['contact_user_id']) {
             $ids[] = $val['contact_user_id'];
         }
     }
     $ids[] = $user_id;
     //新增的联系人不能是添加者本人
     $ids = implode(',', $ids);
     //经销商数据
     $i = 0;
     $model = Dealer::model()->findAll("userID not in ({$ids}) and !ISNULL(organName)");
     foreach ($model as $key => $value) {
         $data[$i]['companyname'] = $value['organName'];
         $data[$i]['userID'] = $value['userID'];
         // $data[$key]['companytype']=$value['userID'];
         $result = User::model()->findByPk($value['userID']);
         switch ($result['identity']) {
             case 1:
                 $data[$i]['companytype'] = '生产商';
                 break;
             case 2:
                 $data[$i]['companytype'] = '经销商';
                 break;
             case 3:
                 $data[$i]['companytype'] = '修理厂';
         }
         $i++;
     }
     //修理厂
     $model = Service::model()->findAll("userId not in ({$ids}) and !ISNULL(serviceName)");
     foreach ($model as $key => $value) {
         $data[$i]['companyname'] = $value['serviceName'];
         $data[$i]['userID'] = $value['userId'];
         //$data[$value['userId']]['companytype']=$value['userId'];
         $result = User::model()->findByPk($value['userId']);
         switch ($result['identity']) {
             case 1:
                 $data[$i]['companytype'] = '生产商';
                 break;
             case 2:
                 $data[$i]['companytype'] = '经销商';
                 break;
             case 3:
                 $data[$i]['companytype'] = '修理厂';
         }
         $i++;
     }
     //生产商
     //    		$model=Yii::app()->db->createCommand()
     //    		->select('*')
     //    		->from('tbl_make_organ')
     //    		->queryAll();
     $model = MakeOrgan::model()->findAll("userID not in ({$ids})");
     foreach ($model as $key => $value) {
         $data[$i]['companyname'] = $value['name'];
         $data[$i]['userID'] = $value['userID'];
         //$data[$key]['companytype']=$value['userID'];
         $result = User::model()->findByPk($value['userID']);
         switch ($result['identity']) {
             case 1:
                 $data[$i]['companytype'] = '生产商';
                 break;
             case 2:
                 $data[$i]['companytype'] = '经销商';
                 break;
             case 3:
                 $data[$i]['companytype'] = '修理厂';
         }
         $i++;
     }
     $rs = array('total' => 1000, 'rows' => $data);
     echo json_encode($rs);
 }
Example #25
0
 public function actionTranslate()
 {
     $rooms = TypeRoom::model()->findAllByAttributes(array('status' => 'ACTIVE'));
     $sqlsm = "";
     $sqlm = "";
     $i = 0;
     foreach ($rooms as $r) {
         $sqlsm .= "insert into `sourcemessage` values (" . $i . ",'rooms','room_" . htmlentities($r->name, ENT_QUOTES, 'UTF-8') . "_name');<br>";
         $sqlm .= "insert into `message` values (" . $i . ",'es','" . htmlentities($r->name, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `message` values (" . $i++ . ",'en','');<br>";
         $sqlsm .= "insert into `sourcemessage` values (" . $i . ",'rooms','room_" . htmlentities($r->name, ENT_QUOTES, 'UTF-8') . "_description');<br>";
         $sqlm .= "insert into `message` values (" . $i . ",'es','" . htmlentities($r->description, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br>";
     $services = Service::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     foreach ($services as $s) {
         $sqlsm .= "insert into `sourcemessage` values (" . $i . ",'services','service_" . htmlentities($s->title, ENT_QUOTES, 'UTF-8') . "_title');<br>";
         $sqlm .= "insert into `message` values (" . $i . ",'es','" . htmlentities($s->title, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `message` values (" . $i++ . ",'en','');<br>";
         if (!is_null($s->description)) {
             $sqlsm .= "insert into `sourcemessage` values (" . $i . ",'services','service_" . htmlentities($s->title, ENT_QUOTES, 'UTF-8') . "_description');<br>";
             $sqlm .= "insert into `message` values (" . $i . ",'es','" . htmlentities($s->description, ENT_QUOTES, 'UTF-8') . "');<br>";
             $sqlm .= "insert into `message` values (" . $i++ . ",'en','');<br>";
         }
     }
     echo $sqlsm;
     echo $sqlm;
 }
 /**
  * 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 Service the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Service::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #27
0
<div class="action">
    <?php 
echo CHtml::link('<i>&#xf234;</i>Add Service', array('add'));
?>
</div>
<?php 
$pageSize = Yii::app()->user->getState('pageSize', Yii::app()->params['defaultPageSize']);
$this->widget('zii.widgets.grid.CGridView', array('id' => 'data-grid', 'dataProvider' => $model->search(array('store_id' => Yii::app()->user->storeID, 'is_shopping' => 1)), 'htmlOptions' => array('class' => 'table tbuser'), 'summaryText' => '', 'filter' => $model, 'columns' => array(array('name' => 'No', 'filter' => false, 'value' => '$row + 1', 'type' => 'raw', 'htmlOptions' => array('class' => 'ct id')), array('name' => 's_image_server', 'value' => '($data->s_image_server != "")?CHtml::image(Yii::app()->baseUrl."/data/service/120x120_".$data->s_image_server,"",array("style"=>"width:35px")):"<div style=\\"width:35px; height:35px; background:#".sprintf("%06x",rand(0,987654))."; margin:0 auto \\"></div>"', 'filter' => false, 'type' => 'raw', 'htmlOptions' => array('class' => 'ct', 'style' => 'padding:0')), array('name' => 's_name', 'value' => 'Chtml::link($data->s_name,array("service/detail","id" => $data->id),array("class"=>"link detailService"))', 'type' => 'raw', 'htmlOptions' => array('class' => 'ct')), array('name' => 's_service_type_id', 'value' => '$data->getType() != null?Chtml::link($data->getType()->s_name,array("serviceType/detail","id" => $data->getType()->id),array("class"=>"link detailService")):$data->s_service_type_id', 'filter' => Service::model()->filterTypeService(), 'type' => 'raw', 'htmlOptions' => array('class' => 'ct')), array('name' => 's_price', 'type' => 'raw', 'filter' => false, 'htmlOptions' => array('class' => 'ct')), array('name' => 's_unit', 'type' => 'raw', 'filter' => false, 'htmlOptions' => array('class' => 'ct')), array('name' => 'i_disable', 'type' => 'raw', 'value' => 'Yii::app()->params["flag.disable"][$data->i_disable]', 'filter' => false, 'htmlOptions' => array('class' => 'ct', 'style' => 'width:110px; padding:1px 2px;')), array('name' => 'i_updated', 'type' => 'raw', 'value' => '($data->i_updated > 0)?date("Y-m-d H:i:s",$data->i_updated):"N/A"', 'filter' => false, 'htmlOptions' => array('class' => 'ct')), array('class' => 'CButtonColumn', 'template' => '{edit}{delete}', 'buttons' => array('edit' => array('label' => '<i>&#xf040;</i> EDIT', 'imageUrl' => false, 'url' => 'array("service/edit","id" => $data->id)', 'options' => array('title' => 'Edit', 'class' => 'btnAction1')), 'delete' => array('label' => '<i>&#xf235;</i> DEL', 'imageUrl' => false, 'options' => array('title' => 'Delete', 'class' => 'btnAction2'))), 'htmlOptions' => array('style' => 'width:123px; padding:1px;'))), 'pager' => array('cssFile' => false, 'class' => 'CLinkPager', 'firstPageLabel' => 'First', 'prevPageLabel' => 'Previous', 'nextPageLabel' => 'Next', 'lastPageLabel' => 'Last', 'header' => '', 'selectedPageCssClass' => 'active'), 'pagerCssClass' => 'pagination'));
?>
 <script>
  $(function(){
    $('.detailService').popup({
        height:500,
    });
 });
 </script>
Example #28
0
 /**
  * 验证机构名称 手机号码 邮箱是否重复
  */
 public function actionCheckorgan()
 {
     $model = Yii::app()->db->createCommand()->select("OrganID as organID")->from("tbl_user")->where("id=:userid", array(":userid" => Yii::app()->user->id))->queryRow();
     if (empty($model['organID'])) {
         $organID = 0;
     } else {
         $organID = $model['organID'];
     }
     $name = $_GET['name'];
     if (!empty($name)) {
         $model = Service::model()->findAll("userId!=:organID and serviceName=:name", array(":organID" => $organID, ":name" => $name));
         if (!empty($model)) {
             $message = "机构名称已存在,不可重复";
         } else {
             $phone = $_GET['phone'];
             if (!empty($phone)) {
                 $model = Service::model()->findAll("userId!=:organID and serviceCellPhone=:phone", array(":organID" => $organID, ":phone" => $phone));
                 if (!empty($model)) {
                     $message = "手机号码已被使用";
                 } else {
                     $email = $_GET['email'];
                     if (!empty($email)) {
                         $model = Service::model()->findAll("userId!=:organID and serviceEmail=:email", array(":organID" => $organID, ":email" => $email));
                         if (!empty($model)) {
                             $message = "邮箱已被使用";
                         }
                     }
                 }
             }
         }
     }
     if (empty($message)) {
         $result = TRUE;
     } else {
         $result = FALSE;
     }
     $resu['result'] = $result;
     $resu['message'] = $message;
     echo json_encode($resu);
 }
 public function actionTranslate()
 {
     $sqlsm = "";
     $sqlm = "";
     $i = 0;
     $authorities = Authority::model()->findAll();
     foreach ($authorities as $r) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'authorities','authority_" . htmlentities($r->id, ENT_QUOTES, 'UTF-8') . "_charge');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($r->charge, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br/>";
     $numbers = Numbers::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     $i = 34;
     foreach ($numbers as $s) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'numbers','numbers_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_field');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->field, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br/>";
     $services = Service::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     $i = 68;
     foreach ($services as $s) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'services','services_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_name');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->name, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'services','services_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_description');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->description, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br/>";
     $modules = Module::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     foreach ($modules as $s) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'services','module_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_name');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->name, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'services','module_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_description');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->description, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br/>";
     $departments = Department::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     $i = 157;
     foreach ($departments as $s) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'departments','department_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_name');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->name, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br/>";
     $specialities = Speciality::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     foreach ($specialities as $s) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'departments','speciality_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_name');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->name, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br/>";
     $news = News::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     $i = 229;
     foreach ($news as $s) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'news','news_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_title');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->title, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'news','news_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_description');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->description, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br/>";
     $doctors = Doctor::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     $i = 406;
     foreach ($doctors as $s) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'doctors','doctor_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_specialty');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->specialism, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'doctors','doctor_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_fellowship');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->fellowship, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'doctors','doctor_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_interests');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->interests, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br/>";
     $sqlm = "";
     $con = mysqli_connect("166.63.0.204", "webcont_dba", "lN_Q*PR]FN[E", "webcont_hm");
     // Check connection
     if (mysqli_connect_errno()) {
         echo "Failed to connect to MySQL: " . mysqli_connect_error();
     }
     $result = mysqli_query($con, "SELECT id_mdc, especialidad_mdc, fellowship_mdc, intereses_mdc FROM medicos");
     $j = 406;
     while ($row = mysqli_fetch_array($result)) {
         $sqlm .= "update `Message` set translation='" . $row['fellowship_mdc'] . "' where id=" . $j++ . " and language='en';<br>";
         $sqlm .= "update `Message` set translation='" . $row['especialidad_mdc'] . "' where id=" . $j++ . " and language='en';<br>";
         $sqlm .= "update `Message` set translation='" . $row['intereses_mdc'] . "' where id=" . $j++ . " and language='en';<br>";
     }
     mysqli_close($con);
     echo $sqlm;
     echo "<br/>";
     $firstaids = FirstAid::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     $i = 1263;
     foreach ($firstaids as $s) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'firstaid','" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_title');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->title, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'firstaid','" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_description');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->description, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
 }
Example #30
0
 public function actionDashboard()
 {
     $service = Service::model()->with('user')->findByPk($this->user->getId());
     if (($post = $this->request->getPost('Service', false)) != false) {
         $service->rules = $post['rules'];
         if ($service->save()) {
             $task = Queue::createTask($this->createUrl('api/pac'), $service->uid);
             Queue::enqueue($task);
         }
     }
     $this->render('dashboard', ['service' => $service]);
 }