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


PHP CWidget::init方法代码示例

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


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

示例1: init

 public function init($category_id = null, $current_tuid = null)
 {
     parent::init();
     global $js_file;
     $js_file['tservices/tservices_catalog'] = 'tservices/tservices_catalog.js';
     if (isset($this->options['limit'])) {
         $this->limit = $this->options['limit'];
     }
     if (isset($this->options['prof_group_id'], $this->options['prof_id']) && !$category_id) {
         require_once ABS_PATH . '/classes/tservices/tservices_categories.php';
         $tservices_categories = new tservices_categories();
         $category_data = $tservices_categories->getCategoryByFreelancersCatalog($this->options['prof_group_id'], $this->options['prof_id']);
         if ($category_data) {
             $category_id = $category_data['id'];
             $this->options['category_title'] = $category_data['title'];
             $this->options['category_stitle'] = $category_data['link'];
         }
     }
     $tservicesCatalogModel = new tservices_catalog();
     $tservicesCatalogModel->setPage($this->limit, 1);
     if (isset($this->options['user_id']) && $this->options['user_id'] > 0) {
         $tservicesCatalogModel->user_id = $this->options['user_id'];
     } elseif ($category_id) {
         $tservicesCatalogModel->category_id = $category_id;
     }
     $exclude_ids = $current_tuid ? array($current_tuid) : array();
     $list = $tservicesCatalogModel->cache($this->ttl_cache)->getList($exclude_ids);
     $this->tservices = $list['list'];
     if ($this->tservices) {
         //расширение сведений о типовых услугах
         $tserviceModel = new TServiceModel();
         $tserviceModel->addOwnerInfo()->extend($this->tservices, 'id');
     }
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:34,代码来源:TServicesPopular.php

示例2: init

 function init()
 {
     parent::init();
     if (trim($this->id) == '' || trim($this->name) == '') {
         throw new CException('必须设置容器id和name值');
     }
     //发布资源
     $this->_assetUrl = Yii::app()->assetManager->publish(Yii::getPathOfAlias('ext.baiduUeditor.resource'));
     $clientScript = Yii::app()->clientScript;
     //注册常量
     $jsConstant = 'window.UEDITOR_HOME_URL = "' . $this->_assetUrl . '/"';
     $clientScript->registerScript('ueditor_constant', $jsConstant, CClientScript::POS_BEGIN);
     //注册js文件
     foreach ($this->jsFiles as $jsFile) {
         $clientScript->registerScriptFile($this->_assetUrl . $jsFile, CClientScript::POS_END);
     }
     //注册css文件
     foreach ($this->cssFiles as $cssFile) {
         $clientScript->registerCssFile($this->_assetUrl . $cssFile);
     }
     //判断是否存在module
     if ($this->owner->module != null) {
         $moduleId = $this->owner->module->id;
         $this->serverUrl = Yii::app()->createUrl($moduleId . '/ueditor');
     } else {
         $this->serverUrl = Yii::app()->createUrl('ueditor');
     }
     //config
     $this->config['serverUrl'] = $this->serverUrl;
     $this->render('ueditor');
 }
开发者ID:zt123,项目名称:Base-System,代码行数:31,代码来源:UeditorWidget.php

示例3: init

 /**
  * Initializes the widget.
  * This method is called by {@link CBaseController::createWidget}
  * and {@link CBaseController::beginWidget} after the widget's
  * properties have been initialized.
  */
 public function init()
 {
     parent::init();
     // EAuth component
     $component = Yii::app()->getComponent($this->component);
     // Some default properties from component configuration
     if (!isset($this->services)) {
         $this->services = $component->getServices();
     }
     if (is_array($this->predefinedServices)) {
         $_services = array();
         foreach ($this->predefinedServices as $_serviceName) {
             if (isset($this->services[$_serviceName])) {
                 $_services[$_serviceName] = $this->services[$_serviceName];
             }
         }
         $this->services = $_services;
     }
     if (!isset($this->popup)) {
         $this->popup = $component->popup;
     }
     // Set the current route, if it is not set.
     if (!isset($this->action)) {
         $this->action = Yii::app()->urlManager->parseUrl(Yii::app()->request);
     }
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:32,代码来源:EAuthWidget.php

示例4: init

 public function init()
 {
     $this->registerScripts();
     $this->options = (require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'tooltip.options.php');
     $this->initTooltip();
     parent::init();
 }
开发者ID:SoftScape,项目名称:open-school-CE,代码行数:7,代码来源:ETooltip.php

示例5: init

 public function init()
 {
     $this->initDefaultButtons();
     parent::init();
     $locale = Yii::app()->getLocale();
     $this->defaultOptions = array('header' => array('left' => 'prev,next today', 'center' => 'title', 'right' => 'agendaDay, agendaWeek, month'), 'defaultView' => 'month', 'axisFormat' => 'HH:mm', 'timeFormat' => 'H:mm{ - H:mm}', 'slotMinutes' => 15, 'snapMinutes' => 5, 'selectable' => true, 'selectHelper' => true, 'allDaySlot' => false, 'editable' => true, 'firstHour' => 11, 'firstDay' => 1, 'uneditableOnLeft' => true, 'droppable' => true, 'monthNames' => array_values($locale->getMonthNames('wide')), 'monthNamesShort' => array_values($locale->getMonthNames('abbreviated')), 'dayNames' => $locale->getWeekDayNames('wide'), 'dayNamesShort' => $locale->getWeekDayNames('abbreviated'), 'buttonText' => array('today' => Yii::t('FullCalendar.fc', 'Today'), 'agendaDay' => Yii::t('FullCalendar.fc', 'Day'), 'agendaWeek' => Yii::t('FullCalendar.fc', 'Week'), 'month' => Yii::t('FullCalendar.fc', 'Month')), 'eventRender' => 'js:function(event, element){if (!event.editable) element.css({opacity: 0.8})}', 'indentationMultiplier' => 0.2);
 }
开发者ID:nineinchnick,项目名称:efullcalendar,代码行数:7,代码来源:FullCalendar.php

示例6: init

 public function init()
 {
     parent::init();
     // TODO: Change the autogenerated stub
     $this->filter = new TServiceFilterForm();
     $this->setFilterAttributes();
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:7,代码来源:TServiceFilter.php

示例7: init

 public function init()
 {
     parent::init();
     Yii::app()->counter->refresh();
     $this->_session = new CHttpSession();
     $this->_session->open();
 }
开发者ID:nctruong,项目名称:inputen,代码行数:7,代码来源:MiisWidget.php

示例8: init

 public function init()
 {
     $dateInfo = CTimestamp::getDate(time());
     $month = $dateInfo['mon'];
     $day = $dateInfo['mday'];
     $yDay = $dateInfo['yday'];
     foreach ($this->signsOrder as $key => $val) {
         $arr = explode('-', $val);
         $start = explode('.', $arr[0]);
         $end = explode('.', $arr[1]);
         settype($start[0], 'integer');
         settype($start[1], 'integer');
         settype($end[0], 'integer');
         settype($end[1], 'integer');
         if ($month >= $start[1] && $month <= $end[1]) {
             if ($day >= $start[0] || $day <= $end[0]) {
                 $signMonth = $key;
                 break;
             }
         }
     }
     $this->_data = Yii::app()->db->createCommand('SELECT p.`post_id`, p.`gallery_id`, h.`content`, h.`publication_date`, p.`title`, p.`created_date`, ph.`filename` 
                                                     FROM horoscope AS h 
                                                     LEFT JOIN posting AS p ON h.`post_id` = p.`post_id`
                                                     LEFT JOIN gallery AS g ON p.`gallery_id` = g.`gallery_id`
                                                     LEFT JOIN photo AS ph ON ph.`gallery_id` = g.`gallery_id`
                                                 WHERE p.`title` LIKE :sign')->queryRow(true, array(':sign' => $this->signs[$signMonth]));
     // этот метод будет вызван внутри CBaseController::beginWidget()
     parent::init();
 }
开发者ID:andreyantonov78,项目名称:atmosphera,代码行数:30,代码来源:GHoroscopeWidget.php

示例9: init

 public function init()
 {
     parent::init();
     // prepare the list of input elements
     foreach ($this->params as $param) {
         $elm = new ParamFormElement($param);
         if (isset($this->config[$param->name])) {
             $pCfg = $this->config[$param->name];
             if (!isset($pCfg['visible']) || $pCfg['visible'] == false) {
                 continue;
             }
             if (isset($pCfg['type'])) {
                 $elm->type = $pCfg['type'];
             }
             if (isset($pCfg['rules']) && is_array($pCfg['rules'])) {
                 $elm->param->rules = array();
                 foreach ($pCfg['rules'] as $rule => $options) {
                     $elm->param->rules[] = array_merge(array('value', $rule), $options);
                 }
                 // $pCfg['rules'];
             }
             if (isset($pCfg['items'])) {
                 $elm->items = $pCfg['items'];
             }
             if (isset($pCfg['htmlOptions'])) {
                 $elm->htmlOptions = $pCfg['htmlOptions'];
             }
         }
         $this->elements[$param->name] = $elm;
     }
 }
开发者ID:hung5s,项目名称:yap,代码行数:31,代码来源:ParamForm.php

示例10: init

 public function init()
 {
     $assetsPath = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets';
     $this->htmlOptions = isset($this->htmlOptions) ? $this->htmlOptions : array();
     $this->selectSepartor = isset($this->selectSepartor) ? $this->selectSepartor : '';
     $this->assetsPath = Yii::app()->getAssetManager()->publish($assetsPath);
     $nameList = array();
     $attributeList = array();
     $dropListInit = 'new PCAS(';
     $attrCity = $this->attributeCity;
     $attrArea = $this->attributeArea;
     $attrProvince = $this->attributeProvince;
     $modelName = get_class($this->model);
     if (isset($this->attributeProvince)) {
         $nameList[] = '"' . $modelName . '[' . $this->attributeProvince . ']' . '"';
         $attributeList[] = '"' . $this->model->{$attrProvince} . '"';
     }
     if (isset($this->attributeCity)) {
         $nameList[] = '"' . $modelName . '[' . $this->attributeCity . ']' . '"';
         $attributeList[] = '"' . $this->model->{$attrCity} . '"';
     }
     if (isset($this->attributeArea)) {
         $nameList[] = '"' . $modelName . '[' . $this->attributeArea . ']' . '"';
         $attributeList[] = '"' . $this->model->{$attrArea} . '"';
     }
     $initArray = array_merge($nameList, $attributeList);
     $dropListInit .= implode(', ', $initArray) . ');';
     Yii::app()->clientScript->registerScriptFile($this->assetsPath . '/PCAS.js');
     Yii::app()->clientScript->registerScript(__CLASS__ . '#' . uniQId(), $dropListInit);
     parent::init();
 }
开发者ID:rikohz,项目名称:Project1,代码行数:31,代码来源:SelectorWidget.php

示例11: init

 public function init()
 {
     parent::init();
     if (!$this->email || !(new CEmailValidator())->validateValue($this->email)) {
         throw new HttpException(500, 'The email you specified is not valid.');
     }
 }
开发者ID:farmani,项目名称:yii-email-obfuscator,代码行数:7,代码来源:Obfuscator.php

示例12: init

 public function init()
 {
     parent::init();
     Yii::app()->clientScript->registerScriptFile('https://apis.google.com/js/plusone.js', CClientScript::POS_END);
     Yii::app()->clientScript->registerScriptFile('http://platform.twitter.com/widgets.js', CClientScript::POS_END);
     Yii::app()->clientScript->registerScriptFile('http://connect.facebook.net/en_US/all.js#appId=362597297166414&xfbml=1', CClientScript::POS_END);
 }
开发者ID:gopi158,项目名称:Sample,代码行数:7,代码来源:WSocialButton.php

示例13: init

 public function init()
 {
     $default = array('skin' => 'default', 'preview' => null, 'allowDelete' => true, 'deleteField' => $this->name . '_delete', 'fileField' => $this->name . '_file', 'url' => '', 'secureuri' => false, 'loader' => $this->id . 'Loader', 'field' => $this->id, 'result' => $this->id . 'Result', 'button' => $this->id . 'ButtonUpload', 'container' => $this->id . 'Container', 'onBeforeSerialize' => '', 'onBeforeSubmit' => '', 'onSuccess' => '', 'url' => '', 'data' => null, 'form' => $this->id . 'Form');
     $this->options = array_merge($default, $this->options);
     $options = CJavaScript::encode($this->options);
     switch ($this->options['skin']) {
         case 'ajax':
             $this->assets = Yii::app()->assetManager->publish(Yii::getPathOfAlias('ext.image.assets'), false, -1, true);
             $cs = Yii::app()->clientScript;
             $cs->registerCoreScript('jquery');
             $cs->registerScriptFile($this->assets . '/ajaxfileupload.js');
             $cs->registerScriptFile($this->assets . '/ajaxfunction.js');
             $cs->registerScript(__CLASS__ . '#' . $this->id, "\$.ajaxFunction({$options});");
             break;
         case 'ajax2':
             $this->assets = Yii::app()->assetManager->publish(Yii::getPathOfAlias('ext.image.assets'), false, -1, true);
             $cs = Yii::app()->clientScript;
             $cs->registerCoreScript('jquery');
             $cs->registerScriptFile($this->assets . '/jquery.form.js');
             // заплатка, не могу понять почему исчезает форма обрамляющая поле файла
             $cs->registerScript(__CLASS__ . '#' . $this->id . 'WrapInner', "\$('#{$this->options['container']}').wrapInner('<form id=\\'{$this->options['form']}\\' enctype=\\'multipart/form-data\\' method=\\'post\\' action=\\'{$this->options['url']}\\'></form>');");
             $cs->registerScript(__CLASS__ . '#' . $this->id, "\$('#{$this->options['form']}').ajaxForm({\n\t\t\t\t\turl: '{$this->options['url']}',\n\t\t\t\t\tdata: " . CJavaScript::encode($this->options['data']) . ",\n\t\t\t\t\tdataType: 'json',\n\t\t\t\t\tbeforeSubmit: function(arr, form, options){\n\t\t\t\t\t\t\$('#" . $this->options['loader'] . "').show();\n\t\t\t\t\t},\n\t\t\t\t\tsuccess: function(data){\n\t\t\t\t\t\t\$('#" . $this->options['loader'] . "').hide();\n\t\t\t\t\t\t\$('#" . $this->options['field'] . "').val('');\n\t\t\t\t\t\tif(typeof(data.error) != 'undefined'){\n\t\t\t\t\t\t\talert(data.error);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t" . ($this->options['onSuccess'] ? CJavaScript::encode($this->options['onSuccess']) : '') . ";\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\terror:function(data){\n\t\t\t\t\t\talert(data);\n\t\t\t\t\t}\n\t\t\t\t});");
             break;
     }
     return parent::init();
 }
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:26,代码来源:uploader.php

示例14: init

 public function init()
 {
     if (empty($this->assetsUrl)) {
         $this->assetsUrl = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'prettyPhoto');
     }
     $this->registerClientScript();
     parent::init();
     $id = $this->getId();
     if (isset($this->htmlOptions['id'])) {
         $id = $this->htmlOptions['id'];
     } else {
         $this->htmlOptions['id'] = $id;
     }
     echo CHtml::openTag($this->tag, $this->htmlOptions) . "\n";
     if (empty($this->options['theme'])) {
         $this->options['theme'] = $this->theme;
     }
     $options = empty($this->options) ? '' : CJavaScript::encode($this->options);
     /*
     Yii::app()->clientScript->registerScript(__CLASS__,"
     	jQuery('#$id a').attr('data-lightbox','prettyPhoto".($this->gallery?'[]':'')."');
     	jQuery('a[data-lightbox^=\"prettyPhoto\"]').prettyPhoto(".$options.');
     ',CClientScript::POS_END);
     */
     // Fix multiple widgets on same page.
     Yii::app()->clientScript->registerScript('prettyPhoto_' . $id, "\n            jQuery('#" . $id . " a').attr('data-lightbox','prettyPhoto_" . $id . "" . ($this->gallery ? '[]' : '') . "');\n            jQuery('a[data-lightbox^=\"prettyPhoto_" . $id . "\"]').prettyPhoto(" . $options . ');
     ', CClientScript::POS_END);
 }
开发者ID:kostya1017,项目名称:our,代码行数:28,代码来源:PrettyPhoto.php

示例15: init

 /**
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     if (!isset($this->htmlOptions['id'])) {
         $this->htmlOptions['id'] = $this->getId();
     }
 }
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:10,代码来源:BootAlert.php


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