function indexAction() { // retrieve the ID of the requested page $pageID = $this->view->pageID = $this->_getParam('ID'); $pageDetails = new PagesIndex(); $pageDetailsSelect = $pageDetails->select(); $pageDetailsSelect->where('PI_PageID = ?', $pageID)->where('PI_LanguageID = ?', $this->_defaultEditLanguage); $pageDetailsData = $pageDetails->fetchRow($pageDetailsSelect)->toArray(); $this->view->assign("pageTitle", $pageDetailsData["PI_PageTitle"]); $authData = $this->view->user; $authID = $authData['EU_ID']; if (Cible_FunctionsAdministrators::checkAdministratorPageAccess($authID, $pageID, "data")) { $authData = $this->view->user; $authID = $authData['EU_ID']; if (Cible_FunctionsAdministrators::checkAdministratorPageAccess($authID, $pageID, "structure")) { $this->view->assign('hasAccessToStructure', true); } // Retrieve the page view layout $page = new Pages(); $page_select = $page->select()->setIntegrityCheck(false); $page_select->from('Pages')->join('Views', 'Pages.P_ViewID = Views.V_ID')->where('P_ID = ?', $pageID); $page_info = Cible_FunctionsPages::getPageViewDetails($pageID); $template_file = 'index/' . $page_info['V_Path']; $_zone_count = $page_info['V_ZoneCount']; // make a request to get all the blocks to be displayed $blocks = new Blocks(); $select = $blocks->select()->setIntegrityCheck(false); $select->from('Blocks')->join('Modules', 'Modules.M_ID = Blocks.B_ModuleID')->join('Pages', 'Blocks.B_PageID = P_ID')->join('BlocksIndex', 'Blocks.B_ID = BlocksIndex.BI_BlockID')->where('Blocks.B_PageID = ?', $pageID)->where('BlocksIndex.BI_LanguageID = ?', Zend_Registry::get('languageID'))->order('Blocks.B_Position ASC'); //Send the results to the view $rows = $blocks->fetchAll($select); $_blocks = array(); foreach ($rows as $row) { // create the placeholder object if not already defined if (!isset($_blocks[$row['B_ZoneID']])) { $_blocks[$row['B_ZoneID']] = array(); } $_blocks[$row['B_ZoneID']][] = $row->toArray(); } $this->view->assign('template_file', $template_file); $this->view->assign('zone_count', $_zone_count); $this->view->assign('blocks', $_blocks); // Load the modules in the view $Modules = new Modules(); $modules = $Modules->fetchAll(); $this->view->assign('modules', $modules->toArray()); } else { $this->view->assign('template_file', ""); $this->view->assign('error_message_permission', $this->view->getCibleText('error_message_permission')); } }
/** * Constructor. * * @access protected */ protected function __construct() { // Init Config Config::init(); // Turn on output buffering ob_start(); // Display Errors Config::get('system.errors.display') and error_reporting(-1); // Set internal encoding function_exists('mb_language') and mb_language('uni'); function_exists('mb_regex_encoding') and mb_regex_encoding(Config::get('system.charset')); function_exists('mb_internal_encoding') and mb_internal_encoding(Config::get('system.charset')); // Set default timezone date_default_timezone_set(Config::get('system.timezone')); // Start the session Session::start(); // Init Cache Cache::init(); // Init Plugins Plugins::init(); // Init Blocks Blocks::init(); // Init Pages Pages::init(); // Flush (send) the output buffer and turn off output buffering ob_end_flush(); }
public function domoveblock() { $blockid = Input::get('block'); $gridid = Input::get('grid'); $block = Blocks::find($blockid); $block->block_position = $gridid; $block->save(); return Response::json(array('type' => 'success', 'text' => Lang::get('grid_manager::messages.block_position_changed'))); }
public function actionDelete() { if (Blocks::model()->deleteByPk($_GET['id'])) { Yii::app()->user->setFlash('success', "Deleted!"); $this->redirect($this->createUrl("index")); } else { Yii::app()->user->setFlash('error', "Error!"); $this->redirect($this->createUrl("index")); } }
public static function menuSide() { $results = Terminals::model()->findAll(array('order' => 'name')); if ($results) { echo "<ul id='sideMenu' class='sample-menu'>"; foreach ($results as $model) { $block_name = $model->name; $results_block = Blocks::model()->findallByAttributes(array('terminals_id' => $model->id), array('order' => 'name')); //получаем массив с элементами относящиеся к терминалу с id_terminal $r = Yii::app()->getRequest()->getQuery('r'); if ($r == 'added/view') { $post_id = Yii::app()->getRequest()->getQuery('id'); } //Получаем id записи (при просмотре) $block_id = Yii::app()->request->getQuery('block_id'); //Получаем block_id (при фильтрации записей) $post = Added::model()->findByAttributes(array('id' => $post_id)); //строка записи id=post_id if ($results_block) { $ul_style = "<ul>"; foreach ($results_block as $model) { //цикл для проверки на совпадение if ($block_id == $model->id || $post->block_id == $model->id) { $ul_style = "<ul style='display: block;'>"; $a_name = "expanded"; } } } echo "<li><a href='#' class='rmenu' name='" . $a_name . "'><span></span>{$block_name}</a>"; $a_name = ""; if ($results_block) { echo $ul_style; foreach ($results_block as $model) { //цикл добавления пунктов меню echo "<li>"; if ($block_id == $model->id || $post->block_id == $model->id) { echo CHtml::link($model->name, array('/added', 'view' => 'index', 'block_id' => $model->id), array('style' => 'color: #73CE27; font-weight: bold')); } else { echo CHtml::link($model->name, array('/added', 'view' => 'index', 'block_id' => $model->id)); } echo "</li>"; } echo "</ul>"; } $a_style = ""; echo "</li>"; } echo "</ul>"; } }
public function command_id($user, $channel, $args) { require_once "Blocks.php"; if ($args[1]) { $block = implode('', $args); } else { $block = $args[0]; } $result = Blocks::GetID($block); echo $result; if ($result) { $this->bot->privmsg($channel, "The ID for " . $block . " is " . $result . "."); } else { $this->bot->privmsg($channel, "Either you typed it wrong, or it doesn't exist (Or we haven't added that name yet)"); } }
<?php include_once 'Blocks.php'; include_once 'ON.php'; $block = new Blocks(); $block->init(); $block->unstack(1, 3); $block->putdown(1); $block->pickup(6); $block->stack(6, 1); echo "Final State: " . $block->toString(); /* Block block = new Block(); block.init(); block.unstack("1", "3"); block.putdown("1"); block.pickup("6"); block.stack("6", "1"); System.out.println("Final state: "+block); */
<div class="view list-blocks _flcear"> <div class='fleft'> <span><b><?php echo '#' . CHtml::encode($data->id); ?> </b></span> <span>Блок: <?php echo CHtml::encode($data->name); ?> </span> <span class="term">Терминал: <?php echo Blocks::terminalName($data->terminals_id); ?> </span> </div> <div class='fright'> <?php echo CHtml::link('Обновить', array('/blocks/update', 'id' => $data->id)); ?> <?php echo CHtml::link(CHtml::encode('Удалить'), array('blocks/delete', 'id' => $data->id), array('submit' => array('blocks/delete', 'id' => $data->id), 'class' => 'delete', 'confirm' => 'Вы подтверждаете удаление?')); ?> </div> </div>
$this->auto->search_array = array(); if ($this->auto->config['block_hot_auto_photo']) { $this->auto->search_array['isset_photo'] = 1; } $this->auto->search_array['sort'] = 'date'; $this->auto->search_array['subsort'] = 'DESC'; $this->auto->search_array['allow_block'] = 1; $this->auto->Search(array("get_count" => 0, "count" => $this->auto->config['block_hot_count_auto'], 'use_order_random' => true)); $this->auto->tpl->load('block_hot_auto')->OpenRow('row_auto'); foreach ($this->auto->autos as $id => $auto_one) { $this->auto->tpl->SetRow($this->auto->ShowAuto($id, array("show_photo" => 0, "show_edit" => 0)) + ShowPhoto($id, $this->auto), 'row_auto'); } $this->auto->tpl->CloseRow('row_auto')->Compile('block_hot_auto'); } } $blocks = new Blocks($auto, $action); if ($auto->config['general_allow_block_search']) { $blocks->BlockDinamic(1, 'block_search'); } if ($auto->config['block_dimanic_allow']) { $blocks->BlockDinamic(); } if ($auto->config['block_last_allow']) { if (!$auto->config['general_cache'] || !($cache = Cache::GetHTMLCache('BlockLast'))) { $blocks->BlockLast(); if ($auto->config['general_cache']) { Cache::SetHTMLCache('BlockLast', $template->block_last_auto); } } else { $template->block_last_auto = $cache; }
<?php /** * This file is part of the Morfy. * * (c) Romanenko Sergey / Awilum <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ // Add {block name=block-name} shortcode Shortcode::add('block', function ($attributes) { if (isset($attributes['name'])) { return Blocks::get($attributes['name']); } }); // Add {site_url} shortcode Shortcode::add('site_url', function () { return Url::getBase(); });
protected function deleteBlock($blockID) { /* * ******************************* */ /* DELETE ROW IN BLOCK TABLE */ /* * ******************************* */ // define block $block = new Blocks(); $where = 'B_ID = ' . $blockID; // get informations of the block to delete $blockDetails = $block->fetchRow($where); $position = $blockDetails->B_Position; $pageID = $blockDetails->B_PageID; // delete the block $block->delete($where); /* * ******************************* */ /* DELETE ROWS IN BLOCKINDEX TABLE */ /* * ******************************* */ // define blockIndex $blockIndex = new BlocksIndex(); $where = 'BI_BlockID = ' . $blockID; // delete all blockIndex $blockIndex->delete($where); /* * ******************************* */ /* UPDATE POSITION ON BLOCK TABLE */ /* * ******************************* */ // update position of all block in the same page $db = Zend_Registry::get("db"); $where = "(B_Position > " . $position . ") AND B_PageID = " . $pageID; $db->update('Blocks', array('B_Position' => new Zend_Db_Expr('B_Position - 1')), $where); /* * ******************************* */ /* DELETE ROWS IN PARAMETERS TABLE */ /* * ******************************* */ $blockParameters = new Parameters(); $where = 'P_BlockID = ' . $blockID; $blockParameters->delete($where); }
$app->get('/new', 'validateUser', function () use($app) { $app->render(ADMIN_THEME . 'blocks.new.php', array('method' => 'new')); }); $app->get('/edit/:id', 'validateUser', function ($id) use($app) { $b = new Blocks(); $block = $b->showBlock($id); $app->render(ADMIN_THEME . 'blocks.edit.php', array('block' => $block, 'method' => 'edit')); }); $app->get('/delete/:id', 'validateUser', function ($id) use($app) { $b = new Blocks(); $b->deleteFromBlock($id); $app->flash('success', 'Block successfully deleted.'); $app->redirect(ADMIN_URL . 'blocks'); }); $app->get('(/(:page))', 'validateUser', function ($page = 1) use($app) { $b = new Blocks(); $start = getPaginationStart($page); $count = $b->countBlockList(); $number_of_pages = ceil($count / LIMIT); $blocks = $b->showBlockList($start, LIMIT); $app->render(ADMIN_THEME . 'blocks.php', array('blocks' => $blocks, 'number_of_pages' => $number_of_pages, 'current_page' => $page, 'page_name' => 'blocks')); }); }); /* * Banlist group * Manage ban list */ $app->group('/ban', function () use($app) { $app->post('/', 'isValidReferrer', 'validateUser', function () use($app) { $ban = new Banlist(); $data = $app->request->post();
<?php require_once "../../require/conexion.class.php"; require_once "../../require/Block_Sensors.class.php"; require_once "../../require/Measurement.class.php"; require_once "../../require/Parameters.class.php"; require_once "../../require/Blocks.class.php"; $DataTime = array(); $DataValue = array(); $Data = array(); $lastID = 0; $long = 0; $Measurement = new Measurement(); $Block_Sensors = new Block_Sensors(); $Parameters = new Parameters(); $Blocks = new Blocks(); $id = (double) $_GET["BS"]; //$id = 2; //$time = $_GET["time_type"]; /* time_type= '24day' --> to show the last 24 hours time_type= '1Week' --> to show the last week time_type= 'All' --> to show all the information until now */ $Block = $Block_Sensors->getblock_byId($id); $ValParameters = $Parameters->getParameter_bySensor($Block["id_sensor"]); $ValBlock = $Blocks->getblock_byId($Block["id_block"]); $Measurement->get_last24hours($Block["id_sensor"]); $months = ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic']; $LimSup = (double) $Block["up_danger_limit"]; $LimInf = (double) $Block["up_risk_limit"];
function DupeFinderStep3Frame(&$db, $vars) { require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/Main.php"; require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Manager/Language/{$MainLanguage}/Item.php"; require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/Item.class.php"; $itemClass = new Item(); if (!$MainMaintenance) { die("Shutdown the server and enable maintenance mode in website before.<br /><br />Desligue o servidor e ative o modo de manutenção no website antes."); } if ($vars['DeleteDup'] == 0 && $vars['DeleteAll'] == 0 && $vars['BlockAccs'] == 0) { die($ItemMessage036); } if ($vars['BlockAccs'] == 1) { require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Manager/System/Blocks.class.php"; $blockClass = new Blocks(); $param = array(); $param['cause'] = $ItemMessage044; $param['image'] = ""; } echo $ItemMessage037 . "<br />" . str_repeat(" ", 4096); flush(); if (!file_exists("../DupedItems")) { die($ItemMessage038); } @ini_set('max_execution_time', 3600); @set_time_limit(0); if ($vars['DeleteAll'] == 1) { $DupeData = array(); $CountData = array(); $handle = fopen("../DupedItems", "r"); while ($data = fgets($handle)) { $DataArray = explode(":", $data); $serial = trim($DataArray[2]); if (!in_array($serial, $DupeData)) { array_push($DupeData, $serial); $CountData[$serial] = 2; } else { $CountData[$serial]++; } } fclose($handle); foreach ($DupeData as $k => $v) { echo "<hr /><strong>> {$ItemMessage030} {$v} (" . $CountData[$v] . " {$ItemMessage035})</strong><br />"; flush(); $ItemData = array(); $db->Query("SELECT AccountID FROM warehouse WHERE (charindex (0x{$v}, items) %16=4)"); while ($data = $db->GetRow()) { array_push($ItemData, $data); } foreach ($ItemData as $k1 => $v1) { $data = $v1; echo $ItemMessage039 . $data[0] . " ... "; $itemClass->DeleteItemFromGame($db, $v, 0, $data[0]); echo "OK!<br />"; flush(); if ($vars['BlockAccs'] == 1) { echo $ItemMessage045 . " ... "; $param['ref'] = "memb___id"; $param['value'] = $data[0]; $blockClass->BlockUser($db, $param); echo "OK!<br />"; flush(); } } $ItemData = array(); $db->Query("SELECT Name FROM Character WHERE (charindex (0x{$v}, inventory) %16=4)"); while ($data = $db->GetRow()) { array_push($ItemData, $data); } foreach ($ItemData as $k1 => $v1) { $data = $v1; echo $ItemMessage040 . $data[0] . " ... "; $itemClass->DeleteItemFromGame($db, $v, 1, $data[0]); echo "OK!<br />"; flush(); if ($vars['BlockAccs'] == 1) { echo $ItemMessage045 . " ... "; $param['ref'] = "Name"; $param['value'] = $data[0]; $blockClass->BlockUser($db, $param); echo "OK!<br />"; flush(); } } $ItemData = array(); $db->Query("SELECT memb___id,idx FROM Z_WebVault WHERE substring(item,7,8) = '{$v}'"); while ($data = $db->GetRow()) { array_push($ItemData, $data); } foreach ($ItemData as $k1 => $v1) { $data = $v1; echo $ItemMessage041 . $data[0] . " ... "; $db->Query("DELETE FROM Z_WebVault WHERE idx = '" . $data[1] . "'"); echo "OK!<br />"; flush(); if ($vars['BlockAccs'] == 1) { echo $ItemMessage045 . " ... "; $param['ref'] = "memb___id"; $param['value'] = $data[0]; $blockClass->BlockUser($db, $param); echo "OK!<br />"; flush(); } } $ItemData = array(); $db->Query("SELECT sale.source,sale.destination,item.via,item.idx FROM Z_WebTradeDirectSale sale, Z_WebTradeDirectSaleItems item WHERE sale.idx = item.sale_idx AND sale.status < '2' AND substring(item.item,7,8) = '{$v}'"); while ($data = $db->GetRow()) { array_push($ItemData, $data); } foreach ($ItemData as $k1 => $v1) { $data = $v1; if ($data[2] == 1) { echo $ItemMessage042 . $data[0] . " ... "; $param['value'] = $data[0]; } else { echo $ItemMessage042 . $data[1] . " ... "; $param['value'] = $data[1]; } $db->Query("DELETE FROM Z_WebTradeDirectSaleItems WHERE idx = '" . $data[3] . "'"); echo "OK!<br />"; flush(); if ($vars['BlockAccs'] == 1) { echo $ItemMessage045 . " ... "; $param['ref'] = "memb___id"; $blockClass->BlockUser($db, $param); echo "OK!<br />"; flush(); } } } @unlink("../DupedItems"); } else { if ($vars['DeleteDup'] == 1) { $handle = fopen("../DupedItems", "r"); while ($data = fgets($handle)) { $DataArray = explode(":", $data); $where = trim($DataArray[0]); $user = trim($DataArray[1]); $serial = trim($DataArray[2]); if ($where == 0) { echo $ItemMessage039 . $user . " ... "; $itemClass->DeleteItemFromGame($db, $serial, $where, $user); echo "OK!<br />"; flush(); } if ($where == 1) { echo $ItemMessage040 . $user . " ... "; $itemClass->DeleteItemFromGame($db, $serial, $where, $user); echo "OK!<br />"; flush(); } if ($where == 2) { echo $ItemMessage041 . $user . " ... "; $db->Query("DELETE FROM Z_WebVault WHERE substring(item,7,8) = '{$serial}' AND memb___id = '{$user}'"); echo "OK!<br />"; flush(); } if ($where == 3) { echo $ItemMessage043 . " ... "; $db->Query("DELETE FROM Z_WebTradeDirectSaleItems WHERE WHERE substring(item,7,8) = '{$serial}' AND sale_idx = '{$user}'"); echo "OK!<br />"; flush(); } } fclose($handle); @unlink("../DupedItems"); } } if ($vars['DeleteDup'] == 0 && $vars['DeleteAll'] == 0 && $vars['BlockAccs'] == 1) { $DupeData = array(); $CountData = array(); $handle = fopen("../DupedItems", "r"); while ($data = fgets($handle)) { $DataArray = explode(":", $data); $serial = trim($DataArray[2]); if (!in_array($serial, $DupeData)) { array_push($DupeData, $serial); $CountData[$serial] = 2; } else { $CountData[$serial]++; } } fclose($handle); foreach ($DupeData as $k => $v) { echo "<hr /><strong>> {$ItemMessage030} {$v} (" . $CountData[$v] . " {$ItemMessage035})</strong><br />"; flush(); $ItemData = array(); $db->Query("SELECT AccountID FROM warehouse WHERE (charindex (0x{$v}, items) %16=4)"); while ($data = $db->GetRow()) { array_push($ItemData, $data); } foreach ($ItemData as $k1 => $v1) { $data = $v1; echo $ItemMessage045 . $data[0] . " ... "; $param['ref'] = "memb___id"; $param['value'] = $data[0]; $blockClass->BlockUser($db, $param); echo "OK!<br />"; flush(); } $ItemData = array(); $db->Query("SELECT Name FROM Character WHERE (charindex (0x{$v}, inventory) %16=4)"); while ($data = $db->GetRow()) { array_push($ItemData, $data); } foreach ($ItemData as $k1 => $v1) { $data = $v1; echo $ItemMessage045 . $data[0] . " ... "; $param['ref'] = "Name"; $param['value'] = $data[0]; $itemClass->BlockUser($db, $param); echo "OK!<br />"; flush(); } $ItemData = array(); $db->Query("SELECT memb___id,idx FROM Z_WebVault WHERE substring(item,7,8) = '{$v}'"); while ($data = $db->GetRow()) { array_push($ItemData, $data); } foreach ($ItemData as $k1 => $v1) { $data = $v1; echo $ItemMessage045 . $data[0] . " ... "; $param['ref'] = "memb___id"; $param['value'] = $data[0]; $itemClass->BlockUser($db, $param); echo "OK!<br />"; flush(); } $ItemData = array(); $db->Query("SELECT sale.source,sale.destination,item.via FROM Z_WebTradeDirectSale sale, Z_WebTradeDirectSaleItems item WHERE sale.idx = item.sale_idx AND sale.status < '2' AND substring(item.item,7,8) = '{$v}'"); while ($data = $db->GetRow()) { array_push($ItemData, $data); } foreach ($ItemData as $k1 => $v1) { $data = $v1; if ($data[2] == 1) { $param['value'] = $data[0]; } else { $param['value'] = $data[1]; } echo $ItemMessage045 . " ... "; $param['ref'] = "memb___id"; $itemClass->BlockUser($db, $param); echo "OK!<br />"; flush(); } } } echo $ItemMessage099; }
$sanity = new Sanity(); require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Manager/System/LoggedOnly.class.php"; new LoggedOnly(); require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/IniSets.class.php"; new IniSets(); require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Manager/System/Manager.class.php"; $mn = new Manager(); require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/MuDatabase.class.php"; $db = new MuDatabase(); if ($mn->GetUserLevel($_SESSION['ManagerId'], $db) < $ManagerBlockUserLevel) { require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Manager/Language/{$MainLanguage}/Manager.php"; $db->Disconnect(); exit("{$ManagerMessage01}"); } require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Manager/System/Blocks.class.php"; $bl = new Blocks($db); switch ($_GET['action']) { default: case "list": echo $bl->BlocksList($db); break; case "block": echo $bl->BlockForm(); break; case "archive": echo $bl->Archive($db); break; case "UnBlock": echo $bl->UnBlock($db, $_POST); break; case "BlockUser":
/** * Initialize Fansoro Blocks * * <code> * Blocks::init(); * </code> * * @access public */ public static function init() { return !isset(self::$instance) and self::$instance = new Blocks(); }
public static function deleteAllBlock($PageID) { $textSelect = new Blocks(); $select = $textSelect->select()->setIntegrityCheck(false)->from('Blocks')->where('B_PageID = ?', $PageID)->join('TextData', 'TD_BlockID = B_ID'); $textData = $textSelect->fetchAll($select); foreach ($textData as $text) { $indexData['moduleID'] = $text['B_ModuleID']; $indexData['contentID'] = $text['TD_ID']; $indexData['languageID'] = $text['TD_LanguageID']; $indexData['action'] = 'delete'; Cible_FunctionsIndexation::indexation($indexData); } $Blocks = new Blocks(); $Where = "B_PageID = " . $PageID; $Blocks->delete($Where); }
public function editAction() { $this->view->title = "Modification d'un texte"; if ($this->view->aclIsAllowed('text', 'edit', true)) { $_blockID = $this->_getParam('blockID'); $_pageid = $this->_getParam('pageID'); $_id = $this->_getParam('ID'); $base_dir = $this->getFrontController()->getBaseUrl(); $blockText = new Text(); $select = $blockText->select(); $select->where('TD_BlockID = ?', $_blockID); $select->where('TD_LanguageID = ?', $this->_currentEditLanguage); $block = $blockText->fetchRow($select); $blockSelect = new Blocks(); $selectBloc = $blockSelect->select()->setIntegrityCheck(false)->from('Blocks')->where('B_ID = ?', $_blockID)->join('PagesIndex', 'PI_PageID = B_PageID')->where('PI_LanguageID = ?', $block['TD_LanguageID']); // If block doesn't exist, creates it. if (empty($block)) { $block = $blockText->createRow(array('TD_BlockID' => $_blockID, 'TD_LanguageID' => $this->_currentEditLanguage)); $block->save(); // load it $block = $blockText->fetchRow($select); } if ($_id) { $returnLink = "{$base_dir}/text/index/list-approbation-request/"; } else { $returnLink = "{$base_dir}/page/index/index/ID/{$_pageid}"; } $form = new FormText(array('baseDir' => $base_dir, 'pageID' => $_pageid, 'cancelUrl' => $returnLink, 'toApprove' => $block["TD_ToApprove"])); if (!$this->_request->isPost()) { $block_data = empty($block) ? array() : $block->toArray(); $blockData = $blockSelect->fetchRow($selectBloc); $block_data['PI_PageTitle'] = $blockData['PI_PageTitle']; $form->populate($block_data); } else { $formData = $this->_request->getPost(); if ($form->isValid($formData)) { if (isset($_POST['submitSaveSubmit'])) { $block['TD_ToApprove'] = 1; //header("location:".$returnLink); } elseif (isset($_POST['submitSaveReturnWriting'])) { $block['TD_ToApprove'] = 0; //header("location:".$returnLink); } elseif (isset($_POST['submitSaveOnline'])) { $block['TD_OnlineTitle'] = $formData['TD_DraftTitle']; $block['TD_OnlineText'] = $formData['TD_DraftText']; $block['TD_ToApprove'] = 0; //header("location:".$returnLink); // index the new text if block online $blockData = $blockSelect->fetchRow($selectBloc); if ($blockData['B_Online'] == 1 && $blockData['PI_Status'] == 1) { $indexData['pageID'] = $blockData['B_PageID']; $indexData['moduleID'] = $blockData['B_ModuleID']; $indexData['contentID'] = $block['TD_ID']; $indexData['languageID'] = $block['TD_LanguageID']; $indexData['title'] = $blockData['PI_PageTitle']; $indexData['text'] = ''; $indexData['link'] = ''; $indexData['contents'] = $blockData['PI_PageTitle'] . " " . $block['TD_OnlineText']; $indexData['action'] = 'update'; Cible_FunctionsIndexation::indexation($indexData); } } else { $returnLink = ""; } $block['TD_DraftTitle'] = $formData['TD_DraftTitle']; $block['TD_DraftText'] = $formData['TD_DraftText']; $block->save(); $oPage = new PagesObject(); $pageData['P_ID'] = $_pageid; $pageData['PI_PageTitle'] = $formData['PI_PageTitle']; $oPage->save($_pageid, $pageData, $this->_currentEditLanguage); //if($returnLink <> "") //$this->_redirect("/page/index/index/ID/$_pageid"); } } $this->view->assign('form', $form); $this->view->assign('pageId', $_pageid); $this->view->assign('onlineTitle', isset($block['TD_OnlineTitle']) ? $block['TD_OnlineTitle'] : ''); $this->view->assign('onlineText', isset($block['TD_OnlineText']) ? $block['TD_OnlineText'] : ''); } }
<table class="table table-hover"> <thead> <tr> <th>Название</th> <th>Место</th> <td> </td> </tr> </thead> <tbody> <?php foreach ($pages as $item) { echo '<tr><td><a href="' . $this->createUrl("update", array("id" => $item->id)) . '">' . $item->name . '</a></td>'; echo "<td>" . Blocks::model()->getKeys()[$item->key] . "</td>"; echo '<td><a href="' . $this->createUrl("delete", array("id" => $item->id)) . '" onClick="return confirm(\'Are you sure you want to remove the item?\');">Удалить</a></td>'; echo '</tr>'; } ?> </tbody> </table> <?php } else { echo '<h3>Нет блоков</h3>'; } ?> </div>
?> </h2> <p class="lead"> <?php _e($job->perks, 'r'); ?> </p> <?php } ?> </div> <div class="col-md-3"> <div class="list-group"> <a class="list-group-item text-center"> <?php Blocks::showBlockByID(1); ?> </a> <?php if ($job->how_to_apply == '') { ?> <a class="list-group-item" /> <h4 class="list-group-item-heading"><span class="glyphicon glyphicon-heart"></span> <?php _e($applications); ?> <?php echo $lang->t('apply|applications'); ?> </h4> </a> <a href="<?php
public function indexAction() { $Param = $this->_getParam('Param'); $Action = $Param['action']; // if user has an account and is logged $islogged = Cible_FunctionsGeneral::getAuthentication(); Zend_Registry::set('user', $islogged); // grab the Id, language and title of the page called $Row = $this->_getParam('Row'); $view_template = $Row['V_Path']; Zend_Registry::set('pageID', $Row['PI_PageID']); Zend_Registry::set('languageID', $Row['PI_LanguageID']); Zend_Registry::set('currentUrlAction', $this->_request->getParam('action')); $session = new Cible_Sessions(); $session->languageID = $Row['PI_LanguageID']; Zend_Registry::set('altImageFirst', $Row['PI_AltPremiereImage']); Zend_Registry::set('languageSuffix', $Row['L_Suffix']); $languageSuffix = $Row['L_Suffix']; Zend_Registry::set('pageTitle', $Row['PI_PageTitle']); Zend_Registry::set('pageIndex', $Row['PI_PageIndex']); Zend_Registry::set('current_theme', $Row['PT_Folder']); if (!Zend_Registry::isRegistered('selectedItemMenuLevel')) { Zend_Registry::set('selectedItemMenuLevel', 0); } Zend_Registry::set('config', $this->_config); $absolute_web_root = Zend_Registry::get('absolute_web_root'); // Set Meta Tags $this->view->headMeta()->appendName('viewport', 'width=device-width, initial-scale=1.0'); $this->view->headMeta()->appendName('Author', 'Cible Solutions d\'Affaires'); $this->view->headMeta()->appendName('Copyright', 'Cible Solutions d\'Affaires - ' . date('Y')); $this->view->headMeta()->appendName('Publisher', 'Cible Solutions d\'Affaires - ' . date('Y')); $this->view->headMeta()->appendName('Language', Zend_Registry::get("languageSuffix")); $this->view->placeholder('metaOther')->set($Row['PI_MetaOther']); $this->view->headMeta()->appendName('Description', $Row['PI_MetaDescription']); $this->view->headMeta()->appendName('Keywords', $Row['PI_MetaKeywords']); $this->view->headMeta()->appendName('Robots', 'all, noodp'); $this->view->headMeta()->appendName('Date-Revision-yyyymmdd', date('Ymd')); $this->view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=utf-8'); $this->view->headMeta()->appendHttpEquiv('Content-Language', $languageSuffix . '-ca'); $this->view->headMeta()->appendHttpEquiv('X-UA-Compatible', 'IE=8'); $this->view->headMeta()->appendName('DC.Description', $Row['PI_MetaDescription']); $this->view->headMeta()->appendName('DC.Subject', $Row['PI_MetaKeywords']); $this->view->headMeta()->appendName('DC.format', 'text/html'); $this->view->headMeta()->appendName('DC.language', $languageSuffix . '-ca', array('scheme' => 'RFC3066')); $clientLogo = $this->_config->clientLogo->src; Zend_Registry::set('addThis', "{$absolute_web_root}/themes/default/images/{$languageSuffix}/{$clientLogo}"); $this->view->assign('showTitle', $Row['P_ShowTitle']); $this->view->assign('selectedPage', $Row['PI_PageIndex']); $this->view->assign('imgHeader', $Row['PI_TitleImageSrc']); $this->view->assign('PI_Secure', $Row['PI_Secure']); $this->view->assign('PI_TitleImageAlt', $Row['PI_TitleImageAlt']); $currentPageID = $Row['PI_PageID']; // finds the current page layout and swap it $layout_file = Cible_FunctionsPages::getLayoutPath($currentPageID); $this->_helper->layout->setLayout(str_replace('.phtml', '', $layout_file)); // put the baseurl on a registry key Zend_Registry::set('baseUrl', $this->getFrontController()->getBaseUrl()); // display the page title on the website if (!empty($Row['PI_MetaTitle'])) { $this->view->headTitle($Row['PI_MetaTitle']); $this->view->headMeta()->appendName('DC.title', $Row['PI_MetaTitle']); } else { $this->view->headTitle($this->_config->site->title); $this->view->headTitle()->setSeparator(' > '); $this->view->headTitle(Zend_Registry::get("pageTitle")); } // display metadata on the website $this->view->metaDescription = $Row['PI_MetaDescription']; $this->view->metaKeywords = $Row['PI_MetaKeywords']; $this->view->pageTitle = $Row['PI_PageTitle']; // make a request to get all the blocks to be displayed $Blocks = new Blocks(); $Select = $Blocks->select()->setIntegrityCheck(false); $Select->from('Blocks')->join('Modules', 'Modules.M_ID = Blocks.B_ModuleID')->join('Parameters', 'Parameters.P_BlockID = Blocks.B_ID', array('B_Action' => 'P_Value'))->where('Parameters.P_Number = ?', 999)->where('Blocks.B_PageID = ?', Zend_Registry::get("pageID"))->where('Blocks.B_Online = ?', 1)->order('Blocks.B_Position ASC'); // if (!$islogged) // $Select->where ('B_Secured = ?', 0); $Rows = $Blocks->fetchAll($Select); // Actions to be called in the view for rendering the page's blocks $blocks = array(); // for all blocks to display, call the proper controller module foreach ($Rows as $Row) { $Module = $Row['M_MVCModuleTitle']; $ActionIndex = $Row['B_Action']; $Param['BlockID'] = $Row['B_ID']; $Param['secured'] = $Row['B_Secured']; if (!isset($blocks[$Row['B_ZoneID']])) { $blocks[$Row['B_ZoneID']] = array(); } array_push($blocks[$Row['B_ZoneID']], array('action' => $ActionIndex, 'controller' => 'index', 'module' => $Module, 'params' => $Param)); } $this->view->assign('blocks', $blocks); $this->view->assign('view_template', $view_template); $this->view->assign('currentPageID', $currentPageID); $this->view->assign('absolute_web_root', $absolute_web_root); $i = 0; foreach ($this->_config->themes->default->styles as $style) { if (!is_null($style->ie_version)) { $this->view->headLink()->offsetSetStylesheet(200 + $i, "{$this->view->baseUrl()}/themes/default/css/{$style->filename}", $style->media, $style->ie_version); $this->view->headLink()->prependStylesheet("{$this->view->baseUrl()}/themes/default/css/{$style->filename}", $style->media, $style->ie_version); } else { $this->view->headLink()->offsetSetStylesheet(1, "{$this->view->baseUrl()}/themes/default/css/{$style->filename}", $style->media); $this->view->headLink()->prependStylesheet("{$this->view->baseUrl()}/themes/default/css/{$style->filename}", $style->media); } $i++; } $this->view->headLink(array('rel' => 'canonical', 'href' => $absolute_web_root . $this->_request->getPathInfo())); if ($this->_config->fontController->embeded) { $this->view->headScript()->appendFile($this->view->locateFile('font-controller.js', 'jquery')); $this->view->headScript()->appendFile($this->view->locateFile('jquery.cookie.js', 'jquery')); } if ($this->_config->addthisWidget->embeded) { $this->view->headScript()->appendFile($this->view->locateFile('addthis_widget.js')); } if ($this->_config->setBgStyle) { $this->view->setBgStyle(); } }
JS::add('includes/javascript/JSCookMenu.js'); JS::add('themes/default/javascript/cookmenu.js'); CSS::add('themes/default/style/cookmenu.css'); } global $CPG_SESS; if ($op == 'logout') { unset($CPG_SESS['admin']); $redir = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : $mainindex; cpg_error(_YOUARELOGGEDOUT, _ADMINMENU_LOGOUT, $redir); } else { if ($CLASS['member']->admin_id) { if (!preg_match('#^([a-zA-Z0-9_\\-]+)$#', $op)) { cpg_error(sprintf(_ERROR_BAD_CHAR, strtolower(_ADMIN)), _SEC_ERROR); } $Module = new Module('Admin'); Blocks::$showblocks = $Module->sides; $Blocks = new Blocks(-1); require_once CORE_PATH . 'classes/cpg_adminmenu.php'; $CLASS['adminmenu']->display(); if (file_exists('modules/' . $op . '/admin/index.inc')) { $file = isset($_GET['file']) ? $_GET['file'] : (isset($_POST['file']) ? $_POST['file'] : 'index'); if (!preg_match('#^([a-zA-Z0-9_\\-]+)$#', $file)) { cpg_error(sprintf(_ERROR_BAD_CHAR, strtolower(_BLOCKFILE2)), _SEC_ERROR); } $module_name = $op; get_lang($op, -1); include 'modules/' . $op . '/admin/' . $file . '.inc'; if (defined('HEADER_OPEN')) { require_once 'footer.php'; } else { cpg_error('The requested file, modules/' . $op . '/admin/' . $file . '.inc, didn\'t output data correctly');
echo $form->labelEx($model, 'date_memo', array('label' => 'Дата служебной записки')); ?> <?php echo CHtml::activeDateField($model, 'date_memo'); ?> <?php echo $form->error($model, 'date_memo'); ?> </div> </div> <div class="row block_id"> <?php echo $form->labelEx($model, 'block_id', array('label' => 'Печатная плата')); ?> <?php echo $form->dropDownList($model, 'block_id', CHtml::listData(Blocks::model()->findAll(array('order' => 'name')), 'id', 'name'), array('empty' => '(Выберите из списка)')); ?> <?php echo $form->error($model, 'block_id'); ?> </div> <div class="row"> <?php echo $form->textArea($model, 'note'); ?> <?php echo $form->error($model, 'note'); ?> </div> <?php echo $form->error($model, 'job');
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Blocks the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Blocks::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }