/** * 建構元 */ public function __construct($PMS) { // 必先呼叫父類別建構元 parent::__construct($PMS); // 此處已不須手動註冊模組頁面,由父類別代勞 // 加入語言資源 $this->loadLanguage(); }
public static function getCoursePricePayments($price=0,$number=2,$discount=0){ if ($price == 0 || $number==0){ return; } if ($discount == 0){ return '<div>'.$number.' '.Yii::t('course', '0198').'</div><div class="numbers"><span id="coursePriceStatus2">'.$price." ".Yii::t('courses', '0322').' =</span> '.$price/$number.' '.Yii::t('courses', '0322').' x '.$number.' '.Yii::t('course', '0323').'</div>'; } return '<div>'.$number.' '.Yii::t('course', '0198').'</div><div class="numbers"><span id="coursePriceStatus1">'.$price." ".Yii::t('courses', '0322').'</span> <span id="coursePriceStatus2">'.ModuleHelper::getDiscountedPrice($price, $discount)." ".Yii::t('courses', '0322').'=</span> '.ModuleHelper::getDiscountedPrice($price, $discount)/$number.' '.Yii::t('courses', '0322').' x '.$number.' '.Yii::t('course', '0323').'<span id="discount"> ('.Yii::t('courses', '0144').' - '.$discount.'%)</span></div>'; }
public function deactivation($page_id = null) { $result = false; if (!is_null($page_id) && Pages::model()->existsPage($page_id)) { $link_id = ModulesInPages::model()->getLink($page_id, $this->id); if ($link_id) { $result = ModuleHelper::model()->deactivation($link_id, $this->id); } } return $result; }
public function __construct($PMS) { parent::__construct($PMS); $this->BASEDIR = fullURL(); switch ($this->FEED_UPDATETYPE) { case 1: // MODULEPAGE $this->SELF = $this->BASEDIR . $this->getModulePageURL(); $this->FEED_STATUSFILE = __CLASS__ . '.tmp'; break; case 2: // Update on RegistAfterCommit $this->SELF = $this->BASEDIR . $this->FEED_CACHEFILE; break; } }
public function actionDeactivation($page_id = null) { $result = false; // доступно для пользователей первой роли (например, «Реактиву») $role_id = Users::model()->findByPk(Yii::app()->user->id)->role_id; if ($role_id < 2 && !is_null($page_id) && Pages::model()->existsPage($page_id)) { $link_id = ModulesInPages::model()->getLink($page_id, $this->module->id); if ($link_id) { $result = ModuleHelper::model()->deactivation($link_id, $this->module->id); } } if ($result) { $this->redirect(Yii::app()->baseUrl . '?r=pages/update&id=' . $page_id . '&/#!/tab_fourth'); } else { $this->redirect(Yii::app()->request->baseUrl . '/admin.php'); } }
public function run() { $page_id = $this->page_id; $controller = Yii::app()->getController(); $model = new ModuleHelper(); if (!is_null($page_id) && Pages::model()->existsPage($page_id)) { $model = $this->create_item($page_id, $model); $data['model'] = $model; $data['page_id'] = $page_id; $data['tree'] = ModuleHelper::model()->getTree(); $data['dropdown'] = ModuleHelper::model()->getDropDown($data['tree']); $data['list'] = ModuleHelper::model()->getList(); $this->render('module_helper', $data); } else { $controller->redirect(Yii::app()->request->scriptUrl); } }
// Lines created Array() $totallinescreated = array(); // Index files $indexlines = array(); // Create Folders $folderusersmodules = MAINDIR . DS . 'users' . DS . $_SESSION['uid'] . DS . 'modules' . DS; $folderusersmodulestmp = $folderusersmodules . 'tmp' . DS; $folderusersmodulestmptmpl = $folderusersmodulestmp . DS . 'tmpl' . DS; FileHelper::foldercheck($folderusersmodules); FileHelper::foldercheck($folderusersmodulestmp); FileHelper::foldercheck($folderusersmodulestmptmpl); // Create files $modulelines = ModuleHelper::modulefile($varObject); $xmllines = ModuleHelper::modulexml($varObject); $helperlines = ModuleHelper::helperfile($varObject); $defaultlines = ModuleHelper::defaultfile($varObject); // Set filenames $indexfile = 'index.html'; $modulefile = $folderusersmodulestmp . 'mod_' . $varObject->filename . '.php'; $xmlfile = $folderusersmodulestmp . 'mod_' . $varObject->filename . '.xml'; $helperfile = $folderusersmodulestmp . 'helper.php'; $defaultfile = $folderusersmodulestmptmpl . 'default.php'; $totallinescreated[] = FileHelper::createFile($modulefile, $modulelines); $totallinescreated[] = FileHelper::createFile($xmlfile, $xmllines); $totallinescreated[] = FileHelper::createFile($helperfile, $helperlines); $totallinescreated[] = FileHelper::createFile($defaultfile, $defaultlines); // Zip Files $filestozip[] = $modulefile; $filestozip[] = $xmlfile; $filestozip[] = $helperfile; $filestozip[] = $defaultfile;
<div> <span id="titleModule"><?php echo Yii::t('module', '0221'); ?></span> <span id="oldPrice"> <?php $this->widget('editable.EditableField', array( 'type' => 'text', 'model' => $post, 'attribute' => 'module_price', 'url' => $this->createUrl('module/updateModuleAttribute'), 'title' => Yii::t('module', '0372'), 'placement' => 'right', )); ?> <?php echo Yii::t('module', '0222'); ?> </span> <?php echo ModuleHelper::getDiscountedPrice($post->module_price, 50).Yii::t('module', '0222'); ?> (<?php echo Yii::t('module', '0223'); ?>) </div> </br> <div> <span id="titleModule"><?php echo Yii::t('module', '0224'); ?></span> <?php for ($j = 0; $j < $post->rating; $j++) { ?><span> <img src="<?php echo StaticFilesHelper::createPath('image', 'common', 'starFull.png');?>"> </span><?php } for ($j = $post->rating; $j < 10; $j++) { ?><span> <img src="<?php echo StaticFilesHelper::createPath('image', 'common', 'starEmpty.png');?>"> </span><?php }
public function actionIndex() { //if($this->beginCache('doc_url_'.md5(Yii::app()->request->url), array('duration'=>3600*24))) { $pages = new Pages(); $data = []; $data['helper']['tree'] = ModuleHelper::model()->getTree(); $data['helper']['list'] = ModuleHelper::model()->getList(); $data['tree'] = $pages->getTreePages2(true); // $pages->getTreePages(NULL,$data['tree'],true); $data['pages'] = $pages; $data['doc_id'] = $this->get_id(Yii::app()->request->pathInfo, $data['tree']); // echo '<pre>'; // var_dump($data['tree']); // die; $data['doc_id_top'] = $this->get_id(Yii::app()->request->pathInfo, $data['tree'], 1); $data['doc_id_last'] = $this->get_id(Yii::app()->request->pathInfo, $data['tree'], -1); $data['page_images'] = $pages->get_images($data['doc_id_last']); $data['content'] = trim($pages->getPageText($data['doc_id_last'])); $data['title'] = trim($pages->getPageNameById($data['doc_id_last'])); $data['longtitle'] = trim($pages->findByPk($data['doc_id_last'])->title); if (empty($data['longtitle'])) { $data['longtitle'] = $data['title']; } $data['short'] = trim($pages->findByPk($data['doc_id_last'])->short); $data['code'] = trim($pages->findByPk($data['doc_id_last'])->code); $data['meta_keywords'] = trim($pages->findByPk($data['doc_id_last'])->meta_keywords); $data['meta_description'] = trim($pages->findByPk($data['doc_id_last'])->meta_description); $data['breadcrumbs'] = $this->breadcrumbs($data['doc_id'], $data['doc_id_last']); if (empty($data['meta_keywords'])) { $data['meta_keywords'] = trim($pages->findByPk(1)->meta_keywords); } if (empty($data['meta_description'])) { $data['meta_description'] = trim($pages->findByPk(1)->meta_description); } $data['url_for_menu'] = Yii::app()->request->pathInfo; // следующая/предыдущая страница $data['doc_id_next'] = $this->get_id(Yii::app()->request->pathInfo, $data['tree'], 0, 'next'); $data['doc_id_prev'] = $this->get_id(Yii::app()->request->pathInfo, $data['tree'], 0, 'prev'); $data['additional_main_data'] = ModuleFields::model()->getValueListByPageId(1); // привязка форм switch ($data['doc_id']) { /*case '2': $data['include'] = array('forms/purchase'); $data['include_title'] = ''; break;*/ default: $data['include'] = []; break; } $hidden_pages = []; $pages_id_records_templates = ['lenta_files_category' => [], 'lenta_records_simple' => [], 'lenta_records' => [], 'magazine' => [], 'consult' => []]; $pages_id_redirect_to_next_level = []; $pages_id_not_redirect_to_next_level = [25, 13]; if ($data['doc_id'] == 27) { if ($_POST['type'] == 'vacancy') { if (isset($_FILES['file']) && !empty($_FILES['file']['tmp_name'])) { $filepath = [$_FILES['file']['tmp_name']]; $filename = [$_FILES['file']['name']]; $subject = 'Резюме с сайта «Экопромбанк»'; $message = '<p>Новое резюме с сайта «Экопромбанка» на должность «' . $_POST['title'] . '»</p>'; $this->emails = Settings::model()->getMail2(); $out = $this->sending($subject, [], $filepath, $filename, $message); $this->emails = ''; if ($out == 0) { Yii::app()->user->setFlash('message', '<p class="success"><strong>Спасибо Вам! Мы рассмотрим резюме и свяжемся с Вами в ближайшее время!</strong></p>'); } else { Yii::app()->user->setFlash('message', '<p class="success" style="color:red;"><strong>К сожаленью произошла ошибка. Попробуйте отправить резюме позже или свяжитесь с нами по телефону (342) 200-79-77.</strong></p>'); Yii::app()->user->setFlash('error', '1'); } } else { Yii::app()->user->setFlash('message', '<p class="success" style="color:red;"><strong>Необходимо прикрепить файл.</strong></p>'); Yii::app()->user->setFlash('error', '1'); } Yii::app()->user->setFlash('form_id', $_POST['form_id']); $this->redirect('/' . Yii::app()->request->pathInfo . '/#vform_' . $_POST['form_id']); } } // $this->cookie_basket($data); if (empty(Yii::app()->request->pathInfo)) { /*$login = $this->login(); if((count($login)>0 && empty($login['error'])) || !empty(Yii::app()->user->id)){ if(empty(Yii::app()->request->pathInfo)) $this->redirect('/state/'); $this->redirect('/'.Yii::app()->request->pathInfo.'/'); } $data['error'] = $login['error']; $data['username'] = $login['username']; $data['password'] = $login['password'];*/ $data['doc_id'] = 1; $data['doc_id_top'] = 1; $data['doc_id_last'] = 1; $data['content'] = trim($pages->getPageText($data['doc_id_last'])); $data['title'] = trim($pages->getPageNameById($data['doc_id_last'])); $data['short'] = trim($pages->findByPk($data['doc_id_last'])->short); $data['code'] = 'index'; $data['news_common_doc_id'] = 65; $data['news_common_list'] = ModuleNews::model()->getList(ModulesInPages::model()->getLink($data['news_common_doc_id'], 'news'), 0, 5, 1); $this->render('index', $data); } else { $active_modules = Modules::model()->getActiveModule($data['doc_id_last']); if (count($active_modules)) { if (count($active_modules) == 2 && array_key_exists(6, $active_modules) && array_key_exists(9, $active_modules)) { $this->moduleList3($data); } else { foreach ($active_modules as $a_id => $a) { /*if($a['code']!='news'){ $data['news_common_doc_id'] = 6; $data['news_common_list'] = ModuleNews::model()->getList(ModulesInPages::model()->getLink($data['news_common_doc_id'],'news'),0,1,1); $data['list2_common_doc_id'] = 6; $data['list2_common_list'] = ModuleList2::model()->getList(ModulesInPages::model()->getLink($data['list2_common_doc_id'],'list2'),0,1,1); }*/ switch ($a['code']) { /*case 'catalog': $this->moduleCatalog($data); break;*/ case 'news': $this->moduleNews($data); break 2; case 'list': $this->moduleList($data); break 2; case 'list2': $this->moduleList2($data); break 2; case 'list3': $this->moduleList3($data); break 2; case 'mfiles': $this->moduleMfiles($data); break 2; case 'ymaps': $this->moduleYmaps($data); break 2; /*case 'complaint_book': $this->moduleComplaint_book($data); break; case 'fields': $this->moduleFields($data); break; case 'flats': $this->moduleFlats($data); break; case 'questions': $this->moduleQuestions($data); break;*/ /*case 'complaint_book': $this->moduleComplaint_book($data); break; case 'fields': $this->moduleFields($data); break; case 'flats': $this->moduleFlats($data); break; case 'questions': $this->moduleQuestions($data); break;*/ default: //$this->actionError(); $active_modules = []; break; } } } } if (count($active_modules) == 0) { /*echo $data['doc_id']; die;*/ /* $data['news_common_doc_id'] = 6; $data['news_common_list'] = ModuleNews::model()->getList(ModulesInPages::model()->getLink($data['news_common_doc_id'],'news'),0,1,1); $data['list2_common_doc_id'] = 6; $data['list2_common_list'] = ModuleList2::model()->getList(ModulesInPages::model()->getLink($data['list2_common_doc_id'],'list2'),0,1,1); */ switch ($data['doc_id_last']) { default: switch ($data['doc_id']) { case 0: $this->actionError(); break; case 12: $this->render('safe', $data); break; case 23: $this->render('safe', $data); break; case 39: $this->moduleCardSelect($data); break; case 49: $this->render('perevod', $data); break; case 77: $this->render('exchange', $data); break; case 26: // $mpage_id = ModulesInPages::model()->getLink($data['doc_id_last'],'ymaps'); // $mpage_id = ModulesInPages::model()->getLink(26,'ymaps'); // $data['list'] = ModuleYmapsCategories::model()->getList($mpage_id,0,0,1,true); $cache_hash = md5('data#atms_list'); $data['list'] = Yii::app()->cache->get($cache_hash); if ($data['list'] === false) { $data['list'] = []; $i = 0; foreach ([100 => 256, 101 => 281, 102 => 286] as $page_id => $category_param_id) { $i++; $mpage_id = ModulesInPages::model()->getLink($page_id, 'list4'); $object = []; $object['title'] = Pages::model()->findByPk($page_id)->name; $object['points'] = ''; $object = (object) $object; $object->points = ModuleList4::model()->getList($mpage_id, 0, 0, 1); foreach ($object->points as $key => $value) { $item = ModuleList4::model()->getList4($key, $mpage_id, 2); if (count($item['params'][$category_param_id]['values'])) { $new_params = $item['params'][$category_param_id]['values'][0]['value']['params']; $array = []; foreach ($new_params as $k => $v) { $array[$v['code']] = ['id' => $v['id'], 'title' => $v['title'], 'data_type_id' => $v['data_type_id'], 'value' => '', 'value_id' => '']; if (isset($v['values'][0]['value'])) { $array[$v['code']]['value'] = $v['values'][0]['value']; } if (isset($v['values'][0]['value_id'])) { $array[$v['code']]['value_id'] = $v['values'][0]['value_id']; } } $params = $value->params; $object->points[$key]->params = $params + $array; // echo '<pre>'; // var_dump($new_params); // var_dump($object->points[$key]->params); // echo '</pre>'; // die; } foreach ($object->points[$key]->params as $k => $v) { $object->points[$key]->params[$k] = (object) $v; } } $data['list'][$i] = $object; } Yii::app()->cache->set($cache_hash, $data['list'], 3600 * 24 * 30); } $this->render('atms', $data); break; default: if (!in_array($data['doc_id'], $pages_id_not_redirect_to_next_level)) { $temp_array = []; $temp_array = $pages->getTreePages($data['doc_id'], $temp_array); foreach ($temp_array as $id => $t) { break; } if (count($temp_array) > 0) { $this->redirect($pages->make_url($id)); } } if (!in_array(Yii::app()->request->pathInfo, $hidden_pages)) { $this->render('list', $data); } else { Yii::app()->runController('main/' . Yii::app()->request->pathInfo); } break; } break; } } } // $this->endCache(); //} }
public function __construct($PMS) { parent::__construct($PMS); $this->loadLanguage(); // 載入語言檔 }
public function __construct($PMS) { parent::__construct($PMS); $this->attachLanguage(array('zh_TW' => array('modulename' => '討論串列表', 'no_title' => '發文不可以沒有標題喔', 'link' => '主題列表', 'main_title' => '主題一覽', 'page_title' => '列表模式', 'date' => '日期'), 'en_US' => array('modulename' => 'Thread list', 'no_title' => 'We do NOT accept a post which is no title.', 'link' => 'Thread List', 'main_title' => 'Thread overview', 'page_title' => 'List mode', 'date' => 'Date')), 'en_US'); }
public static function getModulePrice($price){ if ($price == 0){ return '<span class="colorGreen">'.Yii::t('module', '0421').'<span>'; } return '<span id="oldPrice">'.$price.' '.Yii::t('module', '0222').'</span> '.ModuleHelper::getDiscountedPrice($price, 50).Yii::t('module', '0222').'('.Yii::t('module', '0223').')'; }
public static function defaultfile($varObject) { $default = array(); $default[] = '<?php' . $varObject->return; $default[] = ModuleHelper::phpheader('default.php', $varObject); $default[] = ModuleHelper::nodirectaccess($varObject); $default[] = '?>'; return $default; }
/** Load application modules @private **/ private function _loadModules() { // extract module tag preg_match_all('|<site:modules\\[(.*?)\\]\\/>|', self::$global['RESPONSE'], $matches); // load module files if (isset($matches[1]) && count($matches[1]) > 0) { foreach ($matches[1] as $mtxt) { $html = ''; $modules = explode('|', $mtxt); if (count($modules) > 0) { foreach ($modules as $module) { // get params preg_match('/\\{(.*)\\}/', $module, $mparams); if (!empty($mparams)) { $module = str_replace($mparams[0], '', $module); $mparams = json_decode($mparams[0]); } // get from storage $list = ModuleHelper::_('position', $module); if ($list) { foreach ($list as $module_item) { $is_custom = $module_item->name == 'custom'; if (!$is_custom) { $module_item->params = new Parameter($module_item->params); } $html .= ModuleHelper::render($module_item, $is_custom); } } else { // file-based $module_item = array('name' => $module, 'params' => $mparams); $html .= ModuleHelper::render((object) $module_item, false); } } } // display self::$global['RESPONSE'] = str_replace('<site:modules[' . $mtxt . ']/>', $html, self::$global['RESPONSE']); } // foreach } }
public function __construct($PMS) { parent::__construct($PMS); $lang = array('zh_TW' => array('modulename' => '劇情洩漏隱藏', 'neta_notice_label' => '這篇文章可能含有劇情洩漏,要閱讀全文請按下<a href="#">此處</a>展開。', 'postinfo_usage' => '<li><b>要捏他,請在內文使用<span style="color:blue;">%s</span>標籤註明劇情洩漏!</b></li>'), 'en_US' => array('modulename' => 'Hidden Spoilers', 'neta_notice_label' => 'The content may contain spoilers. To view the full article, press <a href="#">HERE</a> to expand.', 'postinfo_usage' => '<li><b>Use <span style="color:blue;">%s</span> tag in content for spoiler alert!</b></li>')); $this->attachLanguage($lang, 'en_US'); }
public function __construct($PMS) { parent::__construct($PMS); }
public function __construct($PMS) { // 儲存 $PMS 參考 if (self::$PMS == null) { self::$PMS = $PMS; } $this->clazz = get_class($this); // 自動註冊模組頁面 if (method_exists($this, 'ModulePage')) { $PMS->hookModuleMethod('ModulePage', $this->clazz); } }
for ($i=$rate; $i<5; $i++) { ?><span> <img src="<?php echo StaticFilesHelper::createPath('image', 'common', 'ratIco0.png'); ?>"/> </span><?php } ?> </div> </div> <div> <span id="titleModule"><?php echo Yii::t('module', '0215'); ?></span> <b> <?php echo $post->lesson_count." ".Yii::t('module', '0216'); ?></b><?php echo ModuleHelper::getModuleDuration($post->lesson_count,$post->module_duration_hours,$post->hours_in_day,$post->days_in_week) ?> </div> <div> <span id="titleModule"><?php echo Yii::t('module', '0221'); ?></span> <?php echo ModuleHelper::getModulePrice($post->module_price) ?> </div> </br> <div> <span id="titleModule"><?php echo Yii::t('module', '0224'); ?></span> <?php for ($j = 0; $j < $post->rating; $j++) { ?><span> <img src="<?php echo StaticFilesHelper::createPath('image', 'common', 'starFull.png');?>"> </span><?php } for ($j = $post->rating; $j < 10; $j++) { ?><span> <img src="<?php echo StaticFilesHelper::createPath('image', 'common', 'starEmpty.png');?>"> </span><?php }
public function __construct($PMS) { parent::__construct($PMS); $this->mypage = $this->getModulePageURL(); }
public static function setMode($text) { self::$mode = $text; }
<div id="teacher<?php echo $i;?>"> <div class="courseTeacher"> <div class="courseTeacherImg"> <a href="<?php echo Yii::app()->createUrl('profile/index', array('idTeacher' => $teachers[$i]->teacher_id));?>"> <img src="<?php echo StaticFilesHelper::createPath('image', 'teachers', $teachers[$i]->foto_url);?>" /> </a> </div> <div class="courseTeacherInfo"> <h3><a href="<?php echo Yii::app()->createUrl('profile/index', array('idTeacher' => $teachers[$i]->teacher_id));?>"><?php echo $teachers[$i]->last_name . " " . $teachers[$i]->first_name; ?></a></h3> <table class="courseTeacherDetail"> <?php $teacherModules = ModuleHelper::getTeacherModules($teachers[$i]->teacher_id, $modules); //var_dump($teachers[0]);die(); for($k = 0; $k < count($teacherModules); $k++){ ?> <tr> <td> <a href="<?php echo Yii::app()->createUrl('module/index', array('idModule' => $teacherModules[$k]));?>"><span class="colorGrey"><?php echo Yii::t('course', '0208'); echo ' '.ModuleHelper::getModuleOrder($teacherModules[$k]);?>: </span><span class="colorP"><?php echo ModuleHelper::getModuleName($teacherModules[$k]); ?></a></span> </td> </tr> <?php } ?> </table> </div> </div> </div> <?php } ?>