public function actionIndex() { $this->_seoTitle = '我要去上课 - 企业定制'; $model = new Customize(); if (isset($_POST['Customize'])) { $model->attributes = $_POST['Customize']; if ($model->validate() and $model->save()) { Yii::app()->user->setFlash('success', '需求已提交成功!感谢您的信任!我们会第一时间联络您进行详尽的信息收集!'); } } $this->render('index', array('model' => $model)); }
public static function init() { self::$cssURL = base_url() . 'assets/custom/css/'; self::$jsURL = base_url() . 'assets/custom/js/'; self::$fontURL = base_url() . 'assets/custom/fonts/'; self::$imgURL = base_url() . 'assets/custom/img/'; }
$hash = isset($_GET['item']) ? $_GET['item'] : null; $tempId = isset($_GET['template']) ? $_GET['template'] : null; $notify = Notify::getByHash($hash); if (empty($notify->id) || !$notify->hasAccess()) { Ajax::outputError('You don\'t have access to this notification'); } if (!($initData = $notify->getJSONContent())) { Ajax::output('Couldn\'t generate default JSON data!'); } $initialData = json_decode($initData, true); $saved = Notify::getByHash($hash); $saved->flags |= Notify::FLAG_TEMPLATE_CHOSE; $saved->template_id = $tempId; $saved->save(); $template = new Templates($tempId); $customize = new Customize($saved); if (!($xmlTemplate = $template->getXmlContent())) { Ajax::outputError('Can\'t read template xml'); } if (!($templateData = $customize->getDefaultData($xmlTemplate))) { Ajax::outputError('Template data couldn\'t be parsed'); } foreach ($initialData['configs']['params'] as $k => $i) { if ($k != 'barStyle' && $k != 'barSymbol') { $templateData[$k] = $initialData['configs']['params'][$k]; } } // E nevoie de lista de barStyle si barSymbol din XML-ul de configurare a template-ului, astfel incat in // cazul unei teme custom sa se seteze barSymbol si barStyle ales de user doar daca tema curenta suporta // tipul de barStyle si barSymbol ales la o tema precedenta (cand se schimba tema). $templateParsedData = $template->getXmlContentParsed();
<?php // Load the style settings $this->load->view('Custom'); Customize::generateStyles(); Customize::generateFonts(); ?> <style type="text/css"> .form-horizontal .form-group { margin-left : 0; margin-right : 0} </style> <div class="container-fluid "> <div class="login row-fluid centering col-lg-8 col-md-9 col-sm-12 col-xs-12 row"> <h1 class="panel-heading row"><?php echo lang('index_heading'); ?> </h1> <p class="subheading col-md-12"><?php echo lang('index_subheading'); ?> </p> <div class="panel form" style="padding: 10px;"> <div class="modal-body row">
$params['display_rules'][$displayRuleId]['ruleType'] = $displayRuleType; } else { $params['configs']['displayRulesFlag'] = 'false'; unset($params['display_rules']); } */ /*} elseif (isset($deleteRule)) { //delete rule line unset($params['display_rules'][$displayRuleId]); $params['display_rules'] = array_values($params['display_rules']); } */ if (!$notify->updateJSON_Data($params, $publish)) { Ajax::outputError('Internal server error! Try again later.'); } else { if ($reloadConfig) { $thash = $params['configs']['template_hash']; $template = Templates::getByHash($thash); $customize = new Customize($notify); $xmlTemplate = $template->getXmlContent(); if (!($reload = $notify->getJSONContent())) { Ajax::output('Can\'t reload json data!'); } } $output = new stdClass(); $output->json = $params; if ($reloadConfig) { $output->config_html = $customize->getHtml($xmlTemplate, $reload); } Ajax::output($output); }
<?php Ajax::requireLoggedIn(); $request = isset($_POST) ? $_POST : $_GET; $quizId = isset($request['quiz']) ? $request['quiz'] : null; $quiz = new Quiz($quizId); if (empty($quiz->id) || !$quiz->hasAccess()) { Ajax::outputError('You don\'t have access to this quiz'); } if (!isset($request['data']) || empty($request['data'])) { Ajax::outputError('Invalid data'); } ignore_user_abort(true); set_time_limit(120); parse_str($request['data'], $data); #$quiz->customize($data); $template = new Templates($quiz->template_id); $xmlTemplate = gzdecode(file_get_contents($template->getXmlLink())); if (empty($xmlTemplate)) { Ajax::outputError('Internal error: Cannot load template xml'); } $customize = new Customize($quiz); $xmlTemplate = $customize->parsePost($xmlTemplate, $data); if ($quiz->actualizeParams($xmlTemplate)) { Ajax::output($quiz); } else { Ajax::outputError('Internal server error: Cannot save your quiz'); }
<?php Ajax::requireLoggedIn(); $hash = isset($_POST['hash']) ? trim($_POST['hash']) : trim($_GET['hash']); $notify = Notify::getByHash($hash); if (empty($notify->id) || !$notify->hasAccess()) { Ajax::outputError('You don\'t have access to this notification'); } $template = new Templates($notify->template_id); $customize = new Customize($notify); // template if (!($xmlTemplate = $template->getXmlContent())) { Ajax::outputError('Can\'t read template xml'); } $jsonData = null; // notification item data if (!($json = $notify->getJSONContent())) { $jsonData = $json; } if ($xmlTemplate) { if ($jsonData) { Ajax::output($customize->getHtml($xmlTemplate, $jsonData)); } else { Ajax::output($customize->getHtml($xmlTemplate, null)); } } else { Ajax::outputError('Internal server error. Try again later'); }