function getSections($id){ $arFilter = Array('IBLOCK_ID'=>$IBLOCK_ID, 'GLOBAL_ACTIVE'=>'Y', "SECTION_ID" => $id); $db_list = CIBlockSection::GetList(Array("SORT" => "ASC"), $arFilter, true); while($ar_result = $db_list->GetNext()) { if (($ar_result["RIGHT_MARGIN"] - $ar_result["LEFT_MARGIN"]) > 1): $ar_result["SECTIONS"] = getSections($ar_result["ID"]); endif; $arSections[] = $ar_result; } return $arSections; }
function getAverageNumberOfStudentsPerSection($demoToken) { $students = getAllStudentsFromSection($demoToken); // TODO: fix var_dump($students); $sections = getSections($demoToken); var_dump($sections); // die('here'); $numberOfSections = count($sections); $numberOfStudents = count($students); // add all the students / add all sections // return $numberOfStudents/$numberOfSections; }
$projectImgLogoPath = RELATIVE_DIR . "projects/" . $project . "/img/logo_" . $project . ".png"; } /** * Project favicon path * @var string */ $projectFaviconPath = RELATIVE_DIR . 'img/favicon.ico'; if (file_exists(DOCUMENT_ROOT . "/projects/" . $project . "/img/favicon_" . $project . ".ico")) { $projectFaviconPath = RELATIVE_DIR . "projects/" . $project . "/img/favicon_" . $project . ".ico"; } /** * List of available languages * @var array */ $allowedLanguages = array('en', 'ru', 'es'); $lang = $allowedLanguages[0]; if (isset($_REQUEST['lang'])) { $lang = allowedParameterValue($_REQUEST['lang'], $allowedLanguages); } /** * Section parameter * @var string */ $_sections = getSections($project, $defaultProject); $section_param = $_sections[0]; if (isset($_GET['section'])) { $section_param = $_GET['section']; } if (isset($_GET['utm_campaign'])) { header('Location: index.php'); }
require_once $_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/main/include.php"; require_once $_SERVER["DOCUMENT_ROOT"] . '/group/u_creative/include/check.php'; require_once $_SERVER["DOCUMENT_ROOT"] . '/group/u_creative/vendor/autoload.php'; CModule::IncludeModule("iblock"); $emails = array('*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**'); var_dump(defined(IBLOCK_ID)); define("NO_KEEP_STATISTIC", true); define("NOT_CHECK_PERMISSIONS", true); function getSections() { CModule::IncludeModule("iblock"); $obCache = new CPHPCache(); $lifeTime = 60 * 60 * 2; $cacheId = 'u_creative_sections'; $data = array(); $arFilter = array('IBLOCK_ID' => IBLOCK_ID); $raw = CIBlockSection::GetList(array('ID' => 'ASC'), $arFilter); while ($item = $raw->Fetch()) { $data[$item['CODE']] = $item['ID']; } $obCache->StartDataCache($lifeTime, $cacheId, "/"); $obCache->EndDataCache(array("SECTIONS" => $data)); return $data; } $sections = getSections(); for ($i = 0; $i < count($emails); $i++) { $array = array("ACTIVE" => "Y", "NAME" => "Заказ: " . $emails[$i], "IBLOCK_ID" => IBLOCK_ID, "PROPERTY_VALUES" => array('EMAIL' => $emails[$i]), "IBLOCK_SECTION_ID" => $sections['exist']); $raw = new CIBlockElement(); $ID = $raw->Add($array); var_dump($array); }
SetPageLanguage(); $showMenu = true; date_default_timezone_set("Europe/Vilnius"); $today = date('Y-m-d H:i:s'); $query = "SELECT * FROM sections where shown=1"; $result = mysqli_query($link, $query) or die(mysql_error()); while ($row = mysqli_fetch_assoc($result)) { $section[] = $row['name']; } $count = count($section); for ($i = 0; $i <= $count - 1; $i++) { $smarty->assign("{$section[$i]}", getContent($section[$i], $link)); } $smarty->assign('lang', $_SESSION["lang"]); $smarty->assign('language', generateLanguageMenu($link)); $smarty->assign('sections', getSections($link)); $smarty->assign('date', $today); $smarty->assign('showMenu', 'true'); $smarty->display('smarty/templates/main/index.tpl'); function CheckAndSetSession() { if (session_status() == PHP_SESSION_NONE) { session_set_cookie_params(3600, "/"); session_start(); } } function SetPageLanguage() { if (isset($_GET['lang'])) { if ($_GET['lang'] == 'en' or $_GET['lang'] == 'lt' or $_GET['lang'] == 'ru') { $lang = $_GET['lang'];
function widget($args, $instance) { extract($args); extract($instance); $plugin_path = get_bloginfo('url') . '/wp-content/plugins/wp-github-plugin'; ?> <div class="widget-container wp-github-widget" data-user="******" data-repo="<?php echo $instance['repo']; ?> " data-plugin-path="<?php echo $plugin_path; ?> "> <?php foreach (getSections() as $k => $section) { ?> <h3 class="wp-widget-section-title"><?echo $section ?></h3> <div class="<?php echo $k; ?> -placeholder"></div> <?php } ?> <?php echo $after_widget; ?> <?php }
foreach ($yearList as $years) { if (isset($_GET['year']) && $_GET['year'] == $years) { echo "<a href=\"#d" . $i . "\" data-toggle=\"collapse\" data-parent=\"#MainMenu\"><span class=\"glyphicon glyphicon-chevron-down\"></span>" . $years . "<button onclick=\"openDeleteYear('" . $years . "');\" style=\"border:0; background:transparent\" class=\"pull-right hidden-xs showopacity glyphicon glyphicon-trash\"></button></a>"; echo "<div class=\"collapse in\" id=\"d" . $i . "\">"; foreach (getSections($years) as $section) { if (isset($_GET['section']) && $_GET['section'] == $section["name"]) { echo "<a onclick=\"updatePrams('" . $years . "','" . $section["name"] . "','" . $section["ID"] . "')\" class=\"active list-group-item\">" . $section["name"] . "<button onclick=\"openEditSection('" . $section["name"] . "','" . $section["ID"] . "','" . $years . "');\" style=\"border:0; background:transparent\" class=\"pull-right hidden-xs showopacity glyphicon glyphicon-pencil\"></button></a>\n"; } else { echo "<a onclick=\"updatePrams('" . $years . "','" . $section["name"] . "','" . $section["ID"] . "')\" class=\"list-group-item\">" . $section["name"] . "<button onclick=\"openEditSection('" . $section["name"] . "','" . $section["ID"] . "','" . $years . "');\" style=\"border:0; background:transparent\" class=\"pull-right hidden-xs showopacity glyphicon glyphicon-pencil\"></button></a>\n"; } } echo "</div>"; } else { echo "<a href=\"#d" . $i . "\" data-toggle=\"collapse\" data-parent=\"#MainMenu\"><span class=\"glyphicon glyphicon-chevron-down\"></span>" . $years . "<button onclick=\"openDeleteYear('" . $years . "');\" style=\"border:0; background:transparent\" class=\"pull-right hidden-xs showopacity glyphicon glyphicon-trash\"></button></a>"; echo "<div class=\"collapse\" id=\"d" . $i . "\">"; foreach (getSections($years) as $section) { echo "<a onclick=\"updatePrams('" . $years . "','" . $section["name"] . "','" . $section["ID"] . "')\" class=\"list-group-item\">" . $section["name"] . "<button onclick=\"openEditSection('" . $section["name"] . "','" . $section["ID"] . "','" . $years . "');\" style=\"border:0; background:transparent\" class=\"pull-right hidden-xs showopacity glyphicon glyphicon-pencil\"></button></a>\n"; } echo "</div>"; } $i++; } ?> </li> <li role="presentation" class="divider"></li> <li><a data-toggle="modal" data-target="#addYear"><span class="glyphicon glyphicon-plus"></span> Add year</a></li> <li><a data-toggle="modal" data-target="#addSection"><span class="glyphicon glyphicon-plus"></span> Add section</a></li> <li><a onclick="openModalVideo()"><span class="glyphicon glyphicon-plus"></span> Add video</a></li> <li><a href="logout"><span class="glyphicon glyphicon-user"></span> Logout</a></li> </ul>
function page_settings() { global $go, $default; $this->template->location = $this->lang->word('settings'); // sub-locations $this->template->sub_location[] = array($this->lang->word('main'), "?a={$go['a']}"); // the record $rs = $this->db->fetchRecord("SELECT *\n FROM " . PX . "objects_prefs\n WHERE obj_ref_type = '" . OBJECT . "'"); $body = $this->error === true ? div($this->error_msg, "id='show-error'") . br() : ''; load_module_helper('files', $go['a']); load_helpers(array('editortools', 'output')); // ++++++++++++++++++++++++++++++++++++++++++++++++++++ $body .= "<div class='bg-grey'>\n"; $body .= "<div class='c3'>\n"; // First column $body .= "<div class='col'>\n"; $body .= ips($this->lang->word('exhibition name'), 'input', 'obj_name', $rs['obj_name'], "maxlength='50'", 'text', $this->lang->word('required'), 'req'); $body .= ips($this->lang->word('advanced mode'), 'getGeneric', 'obj_mode', $rs['obj_mode']); if ($rs['obj_mode'] == 1) { $body .= "<label>" . $this->lang->word('theme') . "</label>\n"; $body .= getThemes(DIRNAME . BASENAME . '/site/', $rs['obj_theme']); $body .= ips($this->lang->word('organize'), 'getOrganize', 'obj_org', $rs['obj_org']); } //$body .= ips($this->lang->word('use editor'), 'getGeneric', 'writing', $rs['writing']); $body .= "</div>\n"; // second column $body .= "<div class='col'>\n"; if ($rs['obj_mode'] == 1) { $body .= label($this->lang->word('pre nav text') . ' ' . span($this->lang->word('html allowed'))); $body .= textarea(stripForForm($rs['obj_itop'], 1), "style='height:99px;'", 'obj_itop'); } $body .= label($this->lang->word('post nav text') . ' ' . span($this->lang->word('html allowed'))); $body .= textarea(stripForForm($rs['obj_ibot'], 1), "style='height:99px;'", 'obj_ibot'); $body .= div(input('upd_settings', 'submit', null, $this->lang->word('update')), "style='text-align: right;'"); $body .= "</div>\n"; if ($rs['obj_mode'] == 1) { // third column $body .= "<div class='col'>\n"; $body .= label($this->lang->word('sections')) . br(); $body .= getSections(); $body .= "</div>\n"; } $body .= "<div class='cl'><!-- --></div>\n"; $body .= "</div>"; $this->template->body = $body; return; }