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


PHP Site::model方法代码示例

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


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

示例1: actionMark

 public function actionMark()
 {
     if (Yii::app()->request->isAjaxRequest && !Yii::app()->user->isGuest) {
         if (!isset($_GET['id'])) {
             throw new CHttpException(404, 'Страница не найденa');
         } else {
             $site_id = $_GET['id'];
             $site = Site::model()->findByPk($site_id);
             if ($site == null) {
                 throw new CHttpException(404, 'Страница не найденa');
             } else {
                 $mark = Mark::model()->find('site_id = :site_id AND user_id = :user_id', array('site_id' => $site->site_id, 'user_id' => Yii::app()->user->id));
                 if ($mark != null) {
                     $mark->delete();
                 }
                 $mark = new Mark();
                 $mark->user_id = Yii::app()->user->id;
                 $mark->site_id = $site_id;
                 $mark->value = $_POST['value'];
                 $mark->save();
                 print 'Ваш голос учтен';
                 Yii::app()->end();
             }
         }
     } else {
         throw new CHttpException(404, 'Страница не найдена');
     }
 }
开发者ID:GKillah,项目名称:social,代码行数:28,代码来源:SiteController.php

示例2: actionIndex

 public function actionIndex($isForced = false, $isDebug = false)
 {
     $console = Console::getInstance($isForced, $isDebug);
     $console->debugStart('Entered');
     //        if (mail('evgeniy.siderka@hyuna.bb', 'test', 'test message')) {
     //            $console->writeLine('OK');
     //        } else {
     //            $console->writeLine('Failure');
     //        }
     $newExecutors = Site::getNewExecutors('2015-11-19 12:20:00');
     $report = '';
     foreach ($newExecutors as $e) {
         $sites = Site::model()->findAllByAttributes(array('executor_id' => $e));
         if (count($sites) < 1) {
             continue;
         }
         $report .= String::build('Positions for "{keyword}" ({date_from} - {date_to})', array('keyword' => $sites[0]->keyword->name, 'date_from' => Time::toPretty($sites[0]->updated_at), 'date_to' => Time::toPretty($sites[count($sites) - 1]->updated_at))) . PHP_EOL;
         foreach ($sites as $s) {
             $report .= String::build('{position}: {site}', array('position' => $s->position, 'site' => String::rebuildUrl($s->link, false, false, true, false))) . PHP_EOL;
         }
     }
     $console->writeLine($report);
     $console->debugEnd();
     return;
 }
开发者ID:evgeniys-hyuna,项目名称:leadsite,代码行数:25,代码来源:TestCommand.php

示例3: init

 public function init($object)
 {
     if (!empty($object->route)) {
         $object->route = \Site::model('I18n')->defineLanguage($object->route);
         $object->beforeRoute = array(\Site::model('I18n')->getLanguage());
     }
 }
开发者ID:cheevauva,项目名称:trash,代码行数:7,代码来源:Common.php

示例4: collection

 public function collection($route)
 {
     $breadcrumbs = Site::model('Breadcrumbs')->getByRoute($route);
     if (empty($breadcrumbs)) {
         $breadcrumbs[] = array('route' => $route, 'name' => Site::model('I18n')->translate('breadcrumbs_backend', 'Breadcrumbs not found'));
     }
     return array('breadcrumbs' => $breadcrumbs);
 }
开发者ID:cheevauva,项目名称:trash,代码行数:8,代码来源:Backend.php

示例5: getSiteNmae

 public static function getSiteNmae($companyId, $id, $istemp)
 {
     if ($istemp) {
         return yii::t('app', '临时座:') . $id % 1000;
     } else {
         $site = Site::model()->with('siteType')->find(' t.dpid=:dpid and t.lid=:lid', array(':dpid' => $companyId, ':lid' => $id));
         //var_dump($site);exit;
         return $site->siteType->name . ': ' . $site->serial;
     }
 }
开发者ID:song-yuan,项目名称:wymenujp,代码行数:10,代码来源:SiteClass.php

示例6: init

 /**
  * 初始化
  * @see CController::init()
  */
 public function init()
 {
     $site = Site::model()->find();
     $this->_seoTitle = $site->title;
     $this->_seoKeyword = $site->keyword;
     $this->_seoDes = $site->des;
     $this->_seoScode = $site->code;
     if ($site->status == 0) {
         self::_closed($site->remark);
     }
 }
开发者ID:s-nice,项目名称:snece,代码行数:15,代码来源:FrontBase.php

示例7: actionThumb

 /**
  * This will copy a file in the files module to a public accessable folder
  * 
  * @param array $params
  * - stromg src: path the the file relative the the sites public storage folder.
  * @return the rsult of the thumb action on the core controller
  * @throws \GO\Base\Exception\AccessDenied when unable to create the folder?
  */
 protected function actionThumb($params)
 {
     $rootFolder = new \GO\Base\Fs\Folder(\GO::config()->file_storage_path . 'site/' . \Site::model()->id);
     $file = new \GO\Base\Fs\File(\GO::config()->file_storage_path . 'site/' . \Site::model()->id . '/' . $params['src']);
     $folder = $file->parent();
     $ok = $folder->isSubFolderOf($rootFolder);
     if (!$ok) {
         throw new \GO\Base\Exception\AccessDenied();
     }
     $c = new \GO\Core\Controller\CoreController();
     return $c->run('thumb', $params, true, false);
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:20,代码来源:FrontController.php

示例8: getTablePrefix

 /**
  * Get table prefix for each site language to be added.
  * @return string
  */
 public function getTablePrefix()
 {
     $siteId = isset($_REQUEST['siteId']) ? $_REQUEST['siteId'] : 0;
     if ($siteId > 0) {
         $site = Site::model()->findByPk($siteId);
         if ($site) {
             return empty($site->table_prefix) ? SITE_ID . '_' : $site->table_prefix;
         } else {
             return SITE_ID . '_';
         }
     }
     return SITE_ID . '_';
 }
开发者ID:hung5s,项目名称:yap,代码行数:17,代码来源:Language.php

示例9: _checkLink

 private function _checkLink()
 {
     $folder = new \GO\Base\Fs\Folder(\Site::assetManager()->getBasePath());
     $templateFolder = $folder->createChild('template', false);
     $mtime = GO::config()->get_setting('site_template_publish_date_' . \Site::model()->id);
     if ($mtime != GO::config()->mtime || !$templateFolder->exists()) {
         $templateFolder->delete();
         $sourceTemplateFolder = new \GO\Base\Fs\Folder($this->getPath() . 'assets');
         if ($sourceTemplateFolder->copy($folder, 'template')) {
             GO::config()->save_setting('site_template_publish_date_' . \Site::model()->id, GO::config()->mtime);
         }
     }
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:13,代码来源:Template.php

示例10: validate

 public function validate($attributes = NULL, $clearErrors = true)
 {
     $valid = parent::validate();
     if (!$this->dpid) {
         return false;
     }
     $site = Site::model()->find('lid<>:siteId and type_id=:typeId and dpid=:companyId and serial=:serial and delete_flag=0', array(':serial' => $this->serial, ':siteId' => $this->lid ? $this->lid : '', ':typeId' => $this->type_id, ':companyId' => $this->dpid));
     if ($site) {
         $this->addError('serial', '座位号已经存在');
         return false;
     }
     return !$this->hasErrors();
 }
开发者ID:song-yuan,项目名称:wymenujp,代码行数:13,代码来源:Site.php

示例11: actionGetOrderId

 public function actionGetOrderId()
 {
     $id = Yii::app()->request->getParam('id');
     $site = Site::model()->with('isfree')->find('t.site_id=:id', array(':id' => $id));
     if ($site->isfree) {
         $order = Order::model()->find('site_no_id=:id', array(':id' => $site->isfree->id));
         $productTotal = OrderProduct::getTotal($order->order_id);
         $total = Helper::calOrderConsume($order, $productTotal);
         echo json_encode(array('status' => true, 'serial' => $site->serial, 'order_id' => $order->order_id, 'total' => $total['total']));
     } else {
         echo json_encode(array('status' => false));
     }
     exit;
 }
开发者ID:song-yuan,项目名称:wymenujp,代码行数:14,代码来源:OrderController.php

示例12: getForRoot

 protected function getForRoot($route)
 {
     $breadcrumbsRoot = \Site::model('Environment')->breadcrumbs_backend;
     if (!empty($route)) {
         foreach ($route as $param) {
             $routeStr .= $param;
             if (!empty($breadcrumbsRoot[$routeStr])) {
                 $breadcrumbs[] = array('route' => $routeStr, 'name' => \Site::model('I18n')->translate($route[0], $breadcrumbsRoot[$routeStr]));
             }
             $routeStr .= '/';
         }
     }
     return $breadcrumbs;
 }
开发者ID:cheevauva,项目名称:trash,代码行数:14,代码来源:Model.php

示例13: actionIndex

 /**
  * 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 actionIndex()
 {
     $model = Site::model()->find();
     if ($model === NULL) {
         $model = new Site();
     }
     if (isset($_POST['Site'])) {
         $model->attributes = $_POST['Site'];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', '信息提交成功!');
         } else {
             Yii::app()->user->setFlash('success', '信息提交失败!');
         }
     }
     $this->render('index', array('model' => $model));
 }
开发者ID:s-nice,项目名称:24int,代码行数:21,代码来源:SiteController.php

示例14: actionList

 public function actionList()
 {
     $admin = new AdminListAutocomplete(SiteSubspecialtyDrug::model(), $this);
     $admin->setListFields(array('id', 'drugs.name', 'drugs.dose_unit'));
     $admin->setCustomDeleteURL('/OphDrPrescription/admin/commondrugsdelete');
     $admin->setCustomSaveURL('/OphDrPrescription/admin/commondrugsadd');
     $admin->setModelDisplayName('Common Drugs List');
     $admin->setFilterFields(array(array('label' => 'Site', 'dropDownName' => 'site_id', 'defaultValue' => Yii::app()->session['selected_site_id'], 'listModel' => Site::model(), 'listIdField' => 'id', 'listDisplayField' => 'short_name'), array('label' => 'Subspecialty', 'dropDownName' => 'subspecialty_id', 'defaultValue' => Firm::model()->findByPk(Yii::app()->session['selected_firm_id'])->serviceSubspecialtyAssignment->subspecialty_id, 'listModel' => Subspecialty::model(), 'listIdField' => 'id', 'listDisplayField' => 'name')));
     // we set default search options
     if ($this->request->getParam('search') == '') {
         $admin->getSearch()->initSearch(array('filterid' => array('site_id' => Yii::app()->session['selected_site_id'], 'subspecialty_id' => Firm::model()->findByPk(Yii::app()->session['selected_firm_id'])->serviceSubspecialtyAssignment->subspecialty_id)));
     }
     $admin->setAutocompleteField(array('fieldName' => 'drug_id', 'jsonURL' => '/OphDrPrescription/default/DrugList', 'placeholder' => 'search for drugs'));
     //$admin->searchAll();
     $admin->listModel();
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:16,代码来源:CommonDrugAdminController.php

示例15: actionList

 public function actionList()
 {
     $admin = new AdminListAutocomplete(SiteSubspecialtyAnaestheticAgentDefault::model(), $this);
     $admin->setListFields(array('id', 'agents.name'));
     $admin->setCustomDeleteURL('/oeadmin/AnaestheticAgentDefaults/delete');
     $admin->setCustomSaveURL('/oeadmin/AnaestheticAgentDefaults/add');
     $admin->setModelDisplayName('Operation Note Anaesthetic Agent Defaults');
     $admin->setFilterFields(array(array('label' => 'Site', 'dropDownName' => 'site_id', 'defaultValue' => Yii::app()->session['selected_site_id'], 'listModel' => Site::model(), 'listIdField' => 'id', 'listDisplayField' => 'short_name'), array('label' => 'Subspecialty', 'dropDownName' => 'subspecialty_id', 'defaultValue' => Firm::model()->findByPk(Yii::app()->session['selected_firm_id'])->serviceSubspecialtyAssignment->subspecialty_id, 'listModel' => Subspecialty::model(), 'listIdField' => 'id', 'listDisplayField' => 'name')));
     // we set default search options
     if ($this->request->getParam('search') == '') {
         $admin->getSearch()->initSearch(array('filterid' => array('subspecialty_id' => Firm::model()->findByPk(Yii::app()->session['selected_firm_id'])->serviceSubspecialtyAssignment->subspecialty_id, 'site_id' => Yii::app()->session['selected_site_id'])));
     }
     $admin->setAutocompleteField(array('fieldName' => 'anaesthetic_agent_id', 'allowBlankSearch' => 1, 'jsonURL' => '/oeadmin/AnaestheticAgentDefaults/search', 'placeholder' => 'search for adding anaesthetic agent'));
     //$admin->searchAll();
     $admin->listModel();
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:16,代码来源:AnaestheticAgentDefaultsController.php


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