public function actionAction() { $criteria = new CDbCriteria(); $criteria->condition = '`key`=:key'; $criteria->params = array(':key' => Globals::SETTING_KEY_MENU); $criteria->order = 'created_at desc'; $criteria->limit = '1'; //var_dump( $criteria);exit; $setting = SettingModel::model()->find($criteria); $this->layout = '/layouts/memberList'; $menu = MenuactionModel::model()->getTree($this->wechatInfo->id); $this->render('action', array('menu' => $menu, 'wechatId' => $this->wechatInfo->id, 'setting' => $setting)); }
public function setHomepage(Ajde_Core_Route $route) { if ($this->_homepageSet) { return; } $this->_homepageSet = true; $homepageNodeId = (int) SettingModel::byName('homepage'); if ($homepageNodeId) { $node = NodeModel::fromPk($homepageNodeId); if ($node) { Config::set('routes.homepage', $node->getUrl()); } } }
<?php /** * Stránka zobrazující detailní informace o příspěvku vybraného podle ID. * * @author Kosek David */ $settingModel = new SettingModel(); $article = $settingModel->getArticle($vars["id"]); if ($article) { ?> <div class="container"> <div class="jumbotron"> <div class="row"> <h2>Detail příspěvku - <?php echo $article['article_name']; ?> </h2> </div> <table class="table table-striped"> <tr> <td>Název</td> <td><?php echo $article['article_name']; ?> </td> </tr> <tr>
<th rowspan="2" class='text-midle'>Rozhodnutí</th> </tr> <tr> <th>Recenzent</th> <th>orig.</th> <th>téma</th> <th>tech.</th> <th>jaz.</th> <th>dop.</th> <th></th> </tr> </thead> <tbody> <?php $settingModel = new SettingModel(); $articles = $settingModel->getAllArticlesWithReview(); $reviewers = $settingModel->getAllReviewers(); foreach ($articles as $article) { $reviewed = $settingModel->getAllReviewed($article['id_article']); if ($article['result'] == 1) { $result = "Přijmuto"; } else { $result = "Nepřijmuto"; } echo '<tr>' . '<td rowspan="4" style="vertical-align: middle;">' . $article['article_name'] . '</td>' . '<td rowspan="4" style="vertical-align: middle;">' . $article['name'] . ", " . $article['authors'] . '</td>'; if (count($reviewed) > 0) { echo '<tr><td class="text-left">' . $reviewed[0]['name'] . '</td>' . '<td class="text-midle">' . $reviewed[0]['originalsReview'] . '</td>' . '<td class="text-midle">' . $reviewed[0]['themeReview'] . '</td>' . '<td class="text-midle">' . $reviewed[0]['technicalReview'] . '</td>' . '<td class="text-midle">' . $reviewed[0]['languagesReview'] . '</td>' . '<td class="text-midle">' . $reviewed[0]['recommendationReview'] . '</td>' . '<td class="text-midle">' . '<input type="hidden" value="' . $reviewed[0]['id_reviewer'] . '" ">' . '<button class="btn btn-danger btn-xs removeReviewer" id="' . $article['id_article'] . '"><i class="fa fa-trash-o"></button></td>' . ' <td rowspan="4" class="text-midle">' . $result . '</td></tr>'; if (count($reviewed) > 1) { echo '<tr><td class="text-left"">' . $reviewed[1]['name'] . '</td>' . '<td class="text-midle"">' . $reviewed[1]['originalsReview'] . '</td>' . '<td class="text-midle"">' . $reviewed[1]['themeReview'] . '</td>' . '<td class="text-midle"">' . $reviewed[1]['technicalReview'] . '</td>' . '<td class="text-midle"">' . $reviewed[1]['languagesReview'] . '</td>' . '<td class="text-midle"">' . $reviewed[1]['recommendationReview'] . '</td>' . '<td class="text-midle""><input type="hidden" value="' . $reviewed[0]['id_reviewer'] . '" ">' . '<button class="btn btn-danger btn-xs removeReviewer" id="' . $article['id_article'] . '"><i class="fa fa-trash-o"></button></td></tr>'; if (count($reviewed) > 2) {
public static function getJsToken($wechatId) { $msg = '参数有误'; $tokenValue = ''; $tokenModel = SettingModel::model()->find("wechatId = :wechatId and `key`=:key", array(':wechatId' => $wechatId, ':key' => Globals::SETTING_KEY_JS_TOKEN)); if ($tokenModel) { if (time() - $tokenModel->created_at < WechatToken::EXPIRES_IN) { $tokenValue = $tokenModel->value; } } if (!$tokenValue) { $jsToken = WechatToken::getJsToken($tokenValue); if ($jsToken['status'] == WechatToken::OK) { $tokenValue = $jsToken['result']; //update token if (!$tokenModel) { $tokenModel = new SettingModel(); $tokenModel->wechatId = $wechatId; $tokenModel->key = Globals::SETTING_KEY_JS_TOKEN; } $tokenModel->value = $tokenValue; $tokenModel->created_at = time(); $tokenModel->save(); } else { $msg = $jsToken['result']; } } return array('tokenValue' => $tokenValue, 'msg' => $msg); }
<?php /** * Stránka zobrazující detailní informace o příspěvku vybraného podle ID. * * @author Kosek David */ $settingModel = new SettingModel(); $user = $settingModel->getUserInfo($vars["id"]); $roles = $settingModel->getRoles(); if ($user) { ?> <div class="container"> <div class="jumbotron"> <header> <h2>Přiřazení role - <?php echo $user['name']; ?> </h2> <br /> </header> <table class="table table-striped"> <tr> <td>ID</td> <td><?php echo $user['id_user']; ?> </td> </tr> <tr>
<?php if (isset($_SESSION['login']['role'])) { $role = $_SESSION['login']['role']; $settingModel = new SettingModel(); $roles = $settingModel->getRoles(); switch ($role) { //admin case $roles[0]['description']: include 'settingAdmin.php'; break; // recenzent // recenzent case $roles[1]['description']: include 'settingReviewer.php'; break; // autor // autor case $roles[2]['description']: include 'settingAuthor.php'; break; // unknow // unknow default: include 'error/404.php'; break; } } else { include 'error/404.php'; }
/** * 缓存设置 */ public function websiteAction() { if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (empty($_POST['Setting']) || !is_array($_POST['Setting'])) { $this->redirect('/setting/website'); } foreach ($_POST['Setting'] as $_k => $_v) { $this->db->update('{{setting}}', array('setting_value' => $_v), 'setting_identify=:setting_identify', array(':setting_identify' => $_k)); } //记录操作日志 $message = '{user_name}修改了站点设置'; $data = array('data' => $_POST['Setting']); UserLogsModel::inst()->add('Setting/Website', '', 'Modify', 'success', $message, $data); //WebsiteModel::inst()->updateCache(); } $settings = SettingModel::inst()->getSettingsByGroup('cache'); $this->getView()->assign(array('settings' => $settings)); }
</div> <br /> <br /> <table class="table table-striped"> <thead> <tr style="text-align: center;"> <th>Název</th> <th>Mé hodnocení</th> <th>Celkové hodnocení</th> <th>Datum hodnocení</th> <th></th> </tr> </thead> <tbody> <?php $settingModel = new SettingModel(); $articles = $settingModel->getAssignedArticlesClosed($_SESSION['login']['id']); foreach ($articles as $article) { echo '<tr><td style="text-align: left;">' . $article['article_name'] . '</td>' . '<td style="text-align: left;">' . ($article['originalsReview'] + $article['themeReview'] + $article['technicalReview'] + $article['languagesReview'] + $article['recommendationReview']) / 5 . '</td>' . '<td style="text-align: left;">' . $article['total_score'] . '</td>' . '<td style="text-align: left;">' . date_format($article['assigned_date'], "d/m/Y") . '</td>'; echo '<td style="text-align: right;">'; if ($article['result'] == 1) { echo '<i class="fa fa-check"></i>'; } else { echo '<i class="fa fa-close"></i>'; } } ?> </tbody> </table> </header>
/** * @param integer pagesize * @param integer CID * @param integer CState * @param integer GState * * @param string order * * @return array $rows */ public function Pages($params = array()) { //设置默认参数 $_defaults_params = array('allow_cache' => false, 'page' => isset($_GET['page']) ? intval($_GET['page']) : 1, 'pagesize' => 10); $params = array_merge($_defaults_params, $params); //有开启缓存功能,则从缓存中取数据, 如果有数据,则直接返回结果 if ($params['allow_cache'] && isset($this->cache)) { $cacheKey = md5('admin.logs.pages' . serialize($params)); $ret = $this->cache->get($cacheKey); if ($ret && is_array($ret)) { return $ret; } } //添加条件 $builds = array('select' => 'COUNT(ul.log_id) AS COUNT', 'from' => array('{{user_logs}}', 'ul')); $sql_params = array(); if (isset($params['searchKey']) && $params['searchKey']) { $builds[] = array('AND', array(array('OR LIKE', 'ul.log_type', ':searchKey_lType'), array('OR LIKE', 'ul.log_action', ':searchKey_lAction'), array('OR LIKE', 'ul.log_result', ':searchKey_lResult'), array('OR LIKE', 'ul.log_message', ':searchKey_lMessage'), array('OR LIKE', 'ul.log_data', ':searchKey_lData'))); $sql_params[':searchKey_lType'] = "%{$params['searchKey']}%"; $sql_params[':searchKey_lAction'] = "%{$params['searchKey']}%"; $sql_params[':searchKey_lResult'] = "%{$params['searchKey']}%"; $sql_params[':searchKey_lMessage'] = "%{$params['searchKey']}%"; $sql_params[':searchKey_lData'] = "%{$params['searchKey']}%"; } $sql = $this->buildQuery($builds); //统计数量 $count = $this->db->queryScalar($sql, $sql_params); //分页处理 $pages = new CPagination($count); //设置分页大小 $pages->pageSize = $params['pagesize']; if (isset($params['orderby']) && $params['orderby']) { $builds['order'] = $params['orderby']; $cmd->order(); } else { $builds['order'] = array('ul.lasttime DESC'); } $builds['select'] = 'ul.log_id, ul.user_id, ul.log_type, ul.log_item_id, ul.log_action, ul.log_result, ul.log_message, ul.log_data, ul.user_ip, ul.lasttime'; $pages->applyLimit($builds); $sql = $this->buildQuery($builds); $result['pages'] = $pages; $result['rows'] = $this->db->queryAll($sql); foreach ($result['rows'] as $key => $row) { $data = json_decode($row['log_data'], true); foreach ($data as $__key => $__value) { $row['log_message'] = str_replace("{{$__key}}", "\"{$__value}\"", $row['log_message']); } $result['rows'][$key] = $row; } //有开启缓存,则把结果添加到缓存中 if ($params['allow_cache'] && isset($this->cache)) { $cacheTimeOut = SettingModel::inst()->getSettingValue('ADMIN_LOGS_TIME_OUT'); $this->cache->set($cacheKey, $result, $cacheTimeOut); unset($cacheTimeOut, $cacheKey); } return $result; }
function op_emailset() { if (isset($_POST['smtp_host'])) { $upate['smtp_host'] = $_POST['smtp_host']; } if (isset($_POST['smtp_port'])) { $upate['smtp_port'] = $_POST['smtp_port']; } if (isset($_POST['smtp_account'])) { $upate['smtp_account'] = $_POST['smtp_account']; } if (isset($_POST['smtp_pass'])) { $upate['smtp_pass'] = $_POST['smtp_pass']; } if (isset($_POST['smtp_from'])) { $upate['smtp_from'] = $_POST['smtp_from']; } include_once "SettingModel.class.php"; $settingModel = new SettingModel(); $r = $settingModel->updateSettings($upate); $config_content = file_get_contents(APP_DIR . "/config/config.ini.php"); $config_content = preg_replace('/(\\["smtp_host"\\]\\s*=\\s*)(.*?)(;)/ism', '\\1"' . $upate['smtp_host'] . '"\\3', $config_content); $config_content = preg_replace('/(\\["smtp_port"\\]\\s*=\\s*)(.*?)(;)/ism', '\\1"' . $upate['smtp_port'] . '"\\3', $config_content); $config_content = preg_replace('/(\\["smtp_account"\\]\\s*=\\s*)(.*?)(;)/ism', '\\1"' . $upate['smtp_account'] . '"\\3', $config_content); $config_content = preg_replace('/(\\["smtp_pass"\\]\\s*=\\s*)(.*?)(;)/ism', '\\1"' . $upate['smtp_pass'] . '"\\3', $config_content); $config_content = preg_replace('/(\\["smtp_from"\\]\\s*=\\s*)(.*?)(;)/ism', '\\1"' . $upate['smtp_from'] . '"\\3', $config_content); $r1 = write_file($config_content, APP_DIR . "/config/config.ini.php"); if ($r && $r1) { show_message_goback(lang('success')); } else { show_message_goback(lang('failed')); } }
?> <h3>Uživatelé čekající na přiřazení role</h3> <table class="table table-striped"> <thead> <tr style="text-align: center;"> <th>ID</th> <th>Jméno</th> <th>Email</th> <th>Organizace</th> <th>Role</th> <th></th> </tr> </thead> <tbody> <?php $settingModel = new SettingModel(); $usersWithout = $settingModel->getUsersWithout(); if (count($usersWithout) != 0) { foreach ($usersWithout as $temp) { echo '<tr><td style="text-align: left;">' . $temp['id_user'] . '</td><td style="text-align: left;">' . $temp['name'] . '</td><td style="text-align: left;">' . $temp['email'] . '</td><td style="text-align: left;">' . $temp['organisation'] . '</td><td style="text-align: center;">-</td>'; echo '<td style="text-align: right;">' . '<a href="index.php?setting=editRole&id=' . $temp['id_user'] . '" class="btn btn-success btn-xs"><i class="fa fa-plus"></i> Přiřadit roli</a></td>'; } } else { echo '<tr><td colspan="6">Žádný z uživatelů nečeká na přiřazení role.</td></tr>'; } ?> </tbody> </table> <br /> <h3>Ostatní uživatelé</h3> <table class="table table-striped">
private function _getToken($wechatId) { $msg = '参数有误'; $tokenValue = ''; $tokenModel = SettingModel::model()->find("wechatId = :wechatId and `key`=:key", array(':wechatId' => $wechatId, ':key' => Globals::SETTING_KEY_ACCESS_TOKEN)); if ($tokenModel) { if (time() - $tokenModel->created_at < WechatToken::EXPIRES_IN) { $tokenValue = $tokenModel->value; } } if (!$tokenValue) { $wechat = WechatModel::model()->findByPk($wechatId); $appid = $wechat->appid; $secret = $wechat->secret; //$tokenObj = new WechatToken($appid, $secret); $token = WechatToken::getToken($appid, $secret); if ($token['status'] == WechatToken::OK) { $tokenValue = $token['result']; //update token if (!$tokenModel) { $tokenModel = new SettingModel(); $tokenModel->wechatId = $wechatId; $tokenModel->key = Globals::SETTING_KEY_ACCESS_TOKEN; } $tokenModel->value = $tokenValue; $tokenModel->created_at = time(); $tokenModel->save(); } else { $msg = $token['result']; } } return array('tokenValue' => $tokenValue, 'msg' => $msg); }
echo '<p class="btn btn-large btn-success">' . $vars['msg'] . '</p>'; } } ?> <table class="table table-striped"> <thead> <tr style="text-align: center;"> <th>Název</th> <th>Autor</th> <th>Datum vložení</th> <th></th> </tr> </thead> <tbody> <?php $settingModel = new SettingModel(); $articles = $settingModel->getArticles($_SESSION['login']['id']); foreach ($articles as $article) { echo '<tr><td style="text-align: left;">' . $article['article_name'] . '</td><td style="text-align: left;">' . $_SESSION['login']['name'] . ", " . $article['authors'] . '</td><td style="text-align: left;">' . date_format($article['create_date'], "d/m/Y") . '</td>'; echo '<td style="text-align: right;">' . '<a href="index.php?setting=detailArticle&id=' . $article['id_article'] . '" class="btn btn-success btn-xs"><i class="fa fa-eye"></i> DETAIL</a> ' . '<a href="index.php?setting=editArticle&id=' . $article['id_article'] . '" class="btn btn-warning btn-xs"><i class="fa fa-pencil"></i> EDITACE</a> ' . '<a href="index.php?setting=deleteArticle&id=' . $article['id_article'] . '" class="btn btn-danger btn-xs"><i class="fa fa-trash-o"></i> ODSTRANIT</a></td>'; } ?> </tbody> </table> </header> </div> <!--<script type="text/javascript"> $(document).ready(function () {
<?php $settingModel = new SettingModel(); $value = $settingModel->getCriteriumReview(); ?> <div class="container"> <div class="jumbotron"> <header> <h2>Nastavení</h2> <br /> </header> <form class="form-horizontal" role="form" action="index.php?setting=setParam" method="POST"> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <label for="form-value" class="control-label">Mezní hodnota rozhodující o přijetí/odmítnutí článku</label> <input type="text" class="form-control" id="form-value" autofocus required name="criterium" value='<?php echo $value['value']; ?> '> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <button type="submit" value="send" class="btn btn-success" id="submit">Uložit</button> </div> </div> </form> </div> </div>
/** * * Enter description here ... * @param unknown_type $params */ public function Pages($params = array()) { //设置默认参数 $_defaults_params = array('allow_cache' => true, 'page' => isset($_GET['page']) ? intval($_GET['page']) : 1, 'pagesize' => 10); $params = array_merge($_defaults_params, $params); //有开启缓存功能,则从缓存中取数据, 如果有数据,则直接返回结果 if ($params['allow_cache'] && isset($this->cache)) { $cacheKey = 'collect.rule.pages.' . serialize($params); $ret = $this->cache->get($cacheKey); if ($ret && is_array($ret)) { return $ret; } } //添加条件 $builds = array('select' => 'COUNT(ct.collect_rule_id) AS COUNT', 'from' => array('{{collect_rule}}', 'ct')); if (isset($params['collect_rule_status']) && !empty($params['collect_rule_status'])) { $builds['where'][] = array('AND', 'ct.collect_rule_status=:collect_rule_status'); $sql_params[':collect_rule_status'] = $params['collect_rule_status']; } else { $builds['where'][] = array('AND', 'ct.collect_rule_status>:collect_rule_status'); $sql_params[':collect_rule_status'] = 0; } if (isset($params['collect_rule_id']) && !empty($params['collect_rule_id'])) { $builds['where'][] = array('AND', 'ct.collect_rule_id=:collect_rule_id'); $sql_params[':collect_rule_id'] = $params['collect_rule_id']; } // if (isset($params['collect_rule_name']) && !empty($params['collect_rule_name'])) { $builds['where'][] = array('LIKE', 'ct.collect_rule_name', '%:collect_rule_name%'); $sql_params[':collect_rule_name'] = $params['collect_rule_name']; } // // if (isset($params['searchKey']) && $params['searchKey']) { $builds['where'][] = array('OR', array('OR LIKE', 'ct.collect_rule_name', ":searchKey")); $sql_params[':searchKey'] = "%{$params['searchKey']}%"; } $sql = $this->buildQuery($builds); //统计数量 $count = $this->db->queryScalar($sql, $sql_params); //分页处理 $pages = new CPagination($count); //设置分页大小 $pages->pageSize = $params['pagesize']; if (isset($params['orderby']) && $params['orderby']) { $builds['order'] = $params['orderby']; } else { $builds['order'] = array('ct.collect_rule_dateline DESC'); } $builds['select'] = 'ct.collect_rule_id, ct.collect_rule_name'; $pages->applyLimit($builds); $sql = $this->buildQuery($builds); $ret = array('pages' => $pages, 'rows' => $this->db->queryAll($sql, $sql_params)); //有开启缓存,则把结果添加到缓存中 if ($params['allow_cache'] && isset($this->cache)) { $cacheTimeout = SettingModel::getSettingValue('COLLECT_TEMPLATE_PAGES_CACHE_TIME'); $this->cache->set($cacheKey, json_encode($ret), $cacheTimeout); unset($cacheTimeout, $cacheKey); } return $ret; }
} } ?> <table class="table table-striped"> <thead> <tr style="text-align: center;"> <th>Název</th> <th>Přiřadil</th> <th>Aktuální hodnocení</th> <th>Datum přiřazení</th> <th></th> </tr> </thead> <tbody> <?php $settingModel = new SettingModel(); $articles = $settingModel->getAssignedArticles($_SESSION['login']['id']); if (count($articles) == 0) { echo "<tr><td colspan='5'>Aktuálně nemáte přiřazené žádné příspěvky</td></tr>"; } else { foreach ($articles as $article) { $currentReview = $settingModel->getCurrentReview($article['id_article']); echo '<tr><td style="text-align: left;">' . $article['article_name'] . '</td>' . '<td style="text-align: left;">' . $article['name'] . '</td>' . '<td style="text-align: left;">' . $currentReview . '</td>' . '<td style="text-align: left;">' . date_format($article['assigned_date'], "d/m/Y") . '</td>'; echo '<td style="text-align: right;">' . '<a href="index.php?setting=reviewArticleDetail&id=' . $article['id_article'] . '" class="btn btn-info btn-xs"><i class="fa fa-commenting-o"></i> DETAIL</a> ' . '<a href="index.php?setting=reviewArticle&id=' . $article['id_review'] . '" class="btn btn-success btn-xs"><i class="fa fa-commenting-o"></i> HODNOTIT</a>'; } } ?> </tbody> </table> </header>
/** * @param integer pagesize * @param integer CID * @param integer CState * @param integer GState * * @param string order * * @return array $rows */ public function Pages($params = array()) { //设置默认参数 $_defaults_params = array('allow_cache' => false, 'page' => isset($_GET['page']) ? intval($_GET['page']) : 1, 'pagesize' => 15); $params = array_merge($_defaults_params, $params); //有开启缓存功能,则从缓存中取数据, 如果有数据,则直接返回结果 if ($params['allow_cache'] && isset($this->cache)) { $cache_key = 'user.pages.' . serialize($params); $ret = $this->cache->get($_cache_key); if ($ret && is_array($ret)) { return $ret; } } //添加条件 $builds = array('select' => 'COUNT(u.user_id) AS COUNT', 'from' => array('{{user}}', 'u'), 'leftJoin' => array('{{group}}', 'g', '`g`.`group_id`=`u`.`group_id`')); if (isset($params['status']) && !empty($params['status'])) { $builds['where'][] = array('AND', 'u.status=:status'); $sql_params = array(':status' => $params['status']); } else { $builds['where'][] = array('AND', 'u.status>:status'); $sql_params = array(':status' => self::STAT_STATUS_DELETED); } if (isset($params['group_id']) && !empty($params['group_id'])) { $groups = GroupModel::inst()->getGroupsByOwner($params['group_id']); $group_ids = array(); $_addons_groups = array(); foreach ($groups as $_k => $_v) { $_addons_groups[] = array("OR", "`u`.`group_id`=:group_id_{$_k}"); $sql_params[":group_id_{$_k}"] = $_v['group_id']; } $builds['where'][] = array('AND', $_addons_groups); } if (isset($params['search_key']) && $params['search_key']) { $builds['where'][] = array('AND', array('OR LIKE', 'u.user_name', ':search_key_1'), array('OR LIKE', 'u.realname', ':search_key_2'), array('OR LIKE', 'u.email', ':search_key_3')); $sql_params[':search_key_1'] = "%{$params['search_key']}%"; $sql_params[':search_key_2'] = "%{$params['search_key']}%"; $sql_params[':search_key_3'] = "%{$params['search_key']}%"; } $sql = $this->buildQuery($builds); //统计数量 $count = $this->db->queryScalar($sql, $sql_params); //分页处理 $pages = new CPagination($count); //设置分页大小 $pages->pageSize = $params['pagesize']; //清空前面执行过的SQL if (isset($params['orderby']) && $params['orderby']) { $builds['order'] = $params['orderby']; } else { $builds['order'] = array('`r`.`role_rank` ASC', '`u`.`user_rank` ASC', '`u`.`user_id` ASC'); } $builds['select'] = 'u.user_id, u.user_name, u.realname, u.email, u.user_id, u.group_id, g.group_name, u.logintimes, u.lastvisit, u.lastip, u.user_rank, u.lasttime, u.dateline, u.is_system, u.status'; $pages->applyLimit($builds); $sql = $this->buildQuery($builds); $result['pages'] = $pages; $result['rows'] = $this->db->queryAll($sql, $sql_params); //有开启缓存,则把结果添加到缓存中 if ($params['allow_cache'] && isset($this->cache)) { $cache_time_out = SettingModel::inst()->getSettingCache('ADMIN_LOGS_TIME_OUT'); $this->cache->add($cache_key, $result, $cache_time_out); unset($cache_time_out, $cache_key); } return $result; }
protected function readSettingsArray() { /*$criteria = new CDbCriteria; $criteria->select = 'SettingName, SettingIdentify, SettingValue'; $criteria->order = 'SettingGroup, Rank, SID ASC'; $data = Setting::model()->findAll($criteria);*/ $sql = "SELECT * FROM {{setting}} ORDER BY setting_group, rank, setting_id ASC"; $data = $this->db->queryAll($sql); self::$__settings = array(); foreach ($data as $_k => $_v) { self::$__settings[$_v['setting_identify']] = array('setting_name' => $_v['setting_name'], 'setting_group' => $_v['setting_group'], 'setting_identify' => $_v['setting_identify'], 'setting_type' => $_v['setting_type'], 'setting_message' => $_v['setting_message'], 'setting_options' => $_v['setting_options'], 'setting_value' => $_v['setting_value'], 'is_system' => $_v['is_system'], 'is_show' => $_v['is_show'], 'rank' => $_v['rank']); } return self::$__settings; }
/** * Shortcut to get setting contents. * * @param string $name * * @return bool|mixed */ function setting($name) { return SettingModel::byName($name); }
<?php $settingModel = new SettingModel(); $article = $settingModel->getAssignedArticlesById($vars["id"]); ?> <div class="container"> <div class="jumbotron"> <header> <h2>Nová recenze k <?php echo $article['article_name']; ?> </h2> <br /> </header> <form class="form-horizontal" role="form" action="index.php?setting=reviewArticle&id=<?php echo $vars["id"]; ?> " method="POST"> <div class="form-group"> <label class="control-label col-sm-2" for="originalValue">Originalita</label> <div class="col-sm-10"> <select class="form-control" name="originalValue" id="originalValue" required> <option value="" disabled selected>Vaše hodnocení</option> <option value='1'>1</option> <option value='2'>2</option> <option value='3'>3</option> <option value='4'>4</option> <option value='5'>5</option> </select> </div> </div>