public function zone_agenda($id_c, $choix) { try { if ($id_c != 0) { $animal = requetemysql::findunanimal2(array('id_ani' => $id_c)); if (empty($animal)) { throw new Exception("Error in findunanimal2 function ! param : id_ani: " + $id_c); } } else { $animal = json_encode($id_c); } // liste des vétos du tour de garde $vetos = requetemysql::listevetos(); if (empty($vetos)) { throw new Exception("Error in listevetos fonction !"); } if ($choix == "week") { render('_agenda', array('title' => 'Agenda partagé du tour de garde', 'animal' => $animal, 'liste_vetos' => $vetos)); } elseif ($choix == "day") { render('_agenda2', array('title' => 'Agenda du ' + date("d/m/y"), 'animal' => $animal, 'liste_vetos' => $vetos)); } } catch (Exception $e) { echo $e->getMessage(); } }
function index_index() { $data = array(); $data['template_file'] = 'admin/index.php'; $data['title'] = 'Trang Admin'; render('layout_admin.php', $data); }
function bill_detail() { $data = array(); $user = adminLogged(); if (!adminLogged()) { redirect('/index.php?c=admin&m=login'); } else { $bill_detail = model('bill')->getBillDetails($_GET['id']); $data['total'] = 0; foreach ($bill_detail as $key => $b) { $book = model('book')->getSingle($b['book_id']); $bill_detail[$key]['name'] = $book['name']; $bill_detail[$key]['price'] = intval($book['price']); $bill_detail[$key]['total'] = $book['price'] * $b['quantity']; $bill_detail[$key]['image'] = $book['image']; $data['total'] += $book['price'] * $b['quantity']; } $data['bill_detail'] = $bill_detail; } $data['statuses'] = array('Chờ duyệt', 'Đang giao hàng', 'Đã giao hàng', 'Hủy'); $data['stt'] = model('bill')->getOneBy($_GET['id'], null)['status']; if (isPostRequest()) { $postData = postData(); db_update('bills', $postData, 'id=' . $_GET['id']); $data['stt'] = $postData['status']; $data['error'] = 'Tình trạng đơn hàng update thành công.'; } $data['user'] = model('user')->getOneBy(model('bill')->getOneBy($_GET['id'], null)['user_id'], null); $data['template_file'] = 'bill/detail.php'; render('layout.php', $data); }
/** * Test the Who's Online block. */ function testWhosOnlineBlock() { $block = $this->drupalPlaceBlock('views_block:who_s_online-who_s_online_block'); // Generate users. $user1 = $this->drupalCreateUser(array('access user profiles')); $user2 = $this->drupalCreateUser(array()); $user3 = $this->drupalCreateUser(array()); // Update access of two users to be within the active timespan. $this->updateAccess($user1->id()); $this->updateAccess($user2->id(), REQUEST_TIME + 1); // Insert an inactive user who should not be seen in the block, and ensure // that the admin user used in setUp() does not appear. $inactive_time = REQUEST_TIME - 15 * 60 - 1; $this->updateAccess($user3->id(), $inactive_time); $this->updateAccess($this->adminUser->id(), $inactive_time); // Test block output. \Drupal::currentUser()->setAccount($user1); $content = entity_view($block, 'block'); $this->drupalSetContent(render($content)); $this->assertRaw(t('2 users'), 'Correct number of online users (2 users).'); $this->assertText($user1->getUsername(), 'Active user 1 found in online list.'); $this->assertText($user2->getUsername(), 'Active user 2 found in online list.'); $this->assertNoText($user3->getUsername(), 'Inactive user not found in online list.'); $this->assertTrue(strpos($this->drupalGetContent(), $user1->getUsername()) > strpos($this->drupalGetContent(), $user2->getUsername()), 'Online users are ordered correctly.'); }
function home_index() { $data = array(); $data['template_file'] = 'index/index.php'; $data['title'] = 'Trang chủ'; render('layout_home.php', $data); }
public function linkSimple($label, $path, $image = null) { $url = \Meta\Builder::replaceURL(\Meta\Builder::replaceOutput($this->row, $path)); $label = \Meta\Builder::replaceOutput($this->row, $label); $link = render('builder-link.php', array('url' => $url, 'label' => $label, 'img' => $image)); return $link; }
/** * Renders an error message. */ function error_message($message) { render('header', ['title' => 'Error']); render('error_message', ['message' => $message]); render('footer'); exit; }
function main() { // создаем сессию session_start(); if (is_current_user()) { // если пользователь уже залогинен, то отправляем его на глапную redirect('./'); } if (is_postback()) { // обрабатываем отправленную форму $dbh = db_connect(); $post_result = register_user($dbh, $user, $errors); db_close($dbh); if ($post_result) { // перенаправляем на главную redirect('./'); } else { // информация о пользователе заполнена неправильно, выведем страницу с ошибками render('register_form', array('form' => $_POST, 'errors' => $errors)); } } else { // отправляем пользователю чистую форму для регистрации render('register_form', array('form' => array(), 'errors' => array())); } }
public static function view_all() { global $db; $query = $db->query('SELECT * FROM scores ORDER BY userid,service'); set('scores', $query->fetchAll(PDO::FETCH_OBJ)); return render('home.php'); }
function events_show() { global $event; $event = new Event(); $event = $event->find($_GET['id']); render(); }
private function content_ajax_page_fc($fcid) { $fcitem = \Drupal\field_collection\Entity\FieldCollectionItem::load($fcid); $target = WG::entity_get_field_value($fcitem, 'field_target'); preg_match('%^([^:]+)://([0-9]+)$%', $target, $m); $itemtype = $m[1]; $id = $m[2]; switch ($itemtype) { case 'public318': $identifier = $id; $text = WG::entity_get_field_formatted_text($fcitem, 'field_annotation'); $stylename = 'large'; $icon_uri = _expo_public318_get_icon_uri($identifier); $icontag = WG::render_styled_image($icon_uri, $stylename); $output = '<div class="sticky-fc-public318">' . '<div class="collicon">' . _expo_coll_url($identifier, $icontag) . '</div>' . '<div class="colltext">' . $text . '</div>' . '</div>'; break; case 'storynode': $nid = $id; $story = node_load($nid); $v = entity_view($story, 'ajaxpage'); $output = render($v); break; default: $tag = "<div class=\"sticky\" id=\"sticky_{$pos}\">" . $itemtype . $pos . "</div>"; } $build = ['#markup' => $output]; return $build; }
function sms_coupon($coupon, $mobile = null) { global $INI; if ($coupon['consume'] == 'Y' || $coupon['expire_time'] < strtotime(date('Y-m-d'))) { return $INI['system']['couponname'] . '已失效'; } $user = Table::Fetch('user', $coupon['user_id']); $order = Table::Fetch('order', $coupon['order_id']); if (!Utility::IsMobile($mobile)) { $mobile = $order['mobile']; if (!Utility::IsMobile($mobile)) { $mobile = $user['mobile']; } } if (!Utility::IsMobile($mobile)) { return '请设置合法的手机号码,以便接受短信'; } $team = Table::Fetch('team', $coupon['team_id']); $partner = Table::Fetch('partner', $coupon['partner_id']); $coupon['end'] = date('Y-n-j', $coupon['expire_time']); $coupon['name'] = $team['product']; $content = render('manage_tpl_smscoupon', array('partner' => $partner, 'coupon' => $coupon, 'user' => $user)); if (true === ($code = sms_send($mobile, $content))) { Table::UpdateCache('coupon', $coupon['id'], array('sms' => array('`sms` + 1'), 'sms_time' => time())); return true; } return $code; }
function index() { modTitle('Planit | Deconnexion'); setAlert('Vous êtes bien déconnecté, redirection vers la page d\'accueil dans 5 secondes', 'danger'); deco(); render(); }
function gen_cmd_pages($cmd, $parent = array()) { $parent[] = $cmd['name']; $binding = $cmd; $binding['synopsis'] = implode(' ', $parent); $binding['path'] = implode('/', $parent); $binding['has-subcommands'] = isset($cmd['subcommands']) ? array(true) : false; if ($cmd['longdesc']) { $docs = $cmd['longdesc']; $docs = htmlspecialchars($docs, ENT_COMPAT, 'UTF-8'); // decrease header level $docs = preg_replace('/^## /m', '### ', $docs); // escape `--` so that it doesn't get converted into `—` $docs = preg_replace('/^(\\[?)--/m', '\\1\\--', $docs); $docs = preg_replace('/^\\s\\s--/m', ' \\1\\--', $docs); // hack to prevent double encoding in code blocks $docs = preg_replace('/ < /', ' < ', $docs); $docs = preg_replace('/ > /', ' > ', $docs); $docs = preg_replace('/ <</', ' <<', $docs); $docs = preg_replace('/"/', '"', $docs); $binding['docs'] = $docs; } $path = __DIR__ . "/commands/" . $binding['path']; if (!is_dir($path)) { mkdir($path); } file_put_contents("{$path}/index.md", render('subcmd-list.mustache', $binding)); if (!isset($cmd['subcommands'])) { return; } foreach ($cmd['subcommands'] as $subcmd) { gen_cmd_pages($subcmd, $parent); } }
function plugin_basic_auth() { $data['bauth_username'] = kget('bauth_username'); $data['bauth_password'] = kget('bauth_password'); $data['bauth_on'] = kget('bauth_on'); return render($data, 'ajax', 'plugin', 'basic_auth'); }
function index() { global $viewhelper; $viewhelper->setPosition(L("apply_friendlink", "tpl")); formhash(); render("friendlink"); }
function executeRequest() { $my_path = Request::getRequestPath(); $my_name = Request::getRequestName(); $peer = new PaginePeer(); $peer->path__EQUAL($my_path); $peer->nome__EQUAL($my_name); $all_pages = $peer->find(); $my_page = $all_pages[0]; $peer_ep = new ElementiPaginaPeer(); $peer_ep->id_pagina__EQUAL($my_page->id); $all_elementi_pagina = $peer_ep->find(); /* * Carico tutti gli elementi pagina * Nel nome di un settore eventualmente ci posso mettere una descrizione * */ foreach ($all_elementi_pagina as $elem) { $categoria = $elem->categoria; $sotto_categoria = $elem->sotto_categoria; $specifica = $elem->specifica; $categoria_instance = __create_instance(StringUtils::underscored_to_camel_case($categoria) . "SectorRenderer"); $result = $categoria_instance->{$sotto_categoria}($specifica); set_sector($elem->path_settore, $result); } /* * Questi rendering popolano i vari settori a modo loro * */ //render pagina render(PageData::instance()->get("/")); //trova il layout e renderizza il tutto. }
/** * Apologizes to user with message. */ function apologize($message) { // require("../templates/header.php"); render("apology.php", ["message" => $message]); //require("../templates/footer.php"); exit; }
function neb_blockify_local_actions($variables) { $actions = render($variables['menu_local_actions']); if (!empty($actions)) { return '<ul class="action-links">' . $actions . '</ul>'; } }
function show($Data, $layout, $params = []) { $vars = ['result' => 'none', 'posts' => get_posts(['orderby' => 'post_date', 'order' => 'DESC']), $layout => $Data->get()]; $vars = array_merge($vars, $params); $html = render('views/manage_' . $layout . '.php', $vars); echo $html; }
function whatToDo($url) { $pm = new PictshareModel(); $data = $pm->urlToData($url); if (!is_array($data) || !$data['hash']) { if (UPLOAD_FORM_LOCATION && $url == UPLOAD_FORM_LOCATION || !UPLOAD_FORM_LOCATION && ($url = '/')) { $upload_answer = $pm->ProcessUploads(); if ($_POST['submit'] == $pm->translate(3) && $upload_answer) { $o = $upload_answer; } else { $o .= $pm->renderUploadForm(); } $vars['content'] = $o; $vars['slogan'] = $pm->translate(2); } if (!$vars && LOW_PROFILE) { header('HTTP/1.0 404 Not Found'); exit; } else { if (!$vars) { $vars['content'] = $pm->translate(12); $vars['slogan'] = $pm->translate(2); } } render($vars); } else { renderImage($data); } }
/** * Gallery display. * * @return string * Return Gallery output string. */ public function gallery() { // Load the language manager service, so we can parse the user's current language. $langcode = $this->languageManager()->getCurrentLanguage('language'); $photographs = $this->loadAllPhotos(); $view_mode = 'teaser'; $gallery = array(); // Loop through the loaded photograph node objects and output their rendered result into a list. foreach ($photographs as $photograph) { $render = node_view($photograph, $view_mode, $langcode); $gallery[] = render($render); } // If the gallery is empty, we should apologise. if (empty($gallery)) { return [ '#type' => 'markup', '#markup' => $this->t('Sorry, I have no photographs to share at the moment'), '#prefix' => '<h2>', '#suffix' => '</h2>', ]; } // Return an item list of photographs for our gallery. return [ '#theme' => 'item_list', '#items' => $gallery, ]; }
/** * Processes variables for the "bootstrap_dropdown" theme hook. * * See theme function for list of available variables. * * @see bootstrap_bootstrap_dropdown() * * @ingroup theme_process */ function bootstrap_process_bootstrap_dropdown(&$variables) { $element =& $variables['element']; $items = array(); foreach ($element['#items'] as $data) { $item_classes = array(); // Dividers. if (empty($data)) { $data = ''; $item_classes[] = 'divider'; } elseif (is_array($data) && (!empty($data['header']) || !empty($data['#header']))) { $item_classes[] = 'dropdown-header'; } elseif (is_array($data) && (!empty($data['disabled']) || !empty($data['#disabled']))) { $item_classes[] = 'disabled'; } elseif (is_array($data) && (!empty($data['active']) || !empty($data['#active']))) { $item_classes[] = 'active'; } // Construct item_list item. $item = array('data' => render($data), 'role' => 'presentation'); if (!empty($item_classes)) { $item['class'] = $item_classes; } $items[] = $item; } // Create the dropdown. $variables['dropdown'] = array('#theme_wrappers' => array('container'), '#attributes' => $element['#wrapper_attributes'], 'toggle' => $element['#toggle'], 'items' => array('#theme' => 'item_list__bootstrap_dropdown', '#items' => $items, '#attributes' => $element['#attributes'])); }
/** * Overrides theme_file_managed_file(). */ function springy_file_managed_file($variables) { $element = $variables['element']; $attributes = array(); if (isset($element['#id'])) { $attributes['id'] = $element['#id']; } if (!empty($element['#attributes']['class'])) { $attributes['class'] = (array) $element['#attributes']['class']; } $attributes['class'][] = 'form-managed-file'; $attributes['class'][] = 'input-group'; $element['upload_button']['#prefix'] = '<span class="input group-btn">'; $element['upload_button']['#suffix'] = '</span>'; $element['remove_button']['#prefix'] = '<span class="input group-btn">'; $element['remove_button']['#suffix'] = '</span>'; if (!empty($element['filename'])) { $element['filename']['#prefix'] = '<div class="form-control">'; $element['filename']['#suffix'] = '</div>'; } $hidden_elements = array(); foreach (element_children($element) as $child) { if ($element[$child]['#type'] === 'hidden') { $hidden_elements[$child] = $element[$child]; unset($element[$child]); } } // This wrapper is required to apply JS behaviors and CSS styling. $output = ''; $output .= '<div' . drupal_attributes($attributes) . '>'; $output .= drupal_render_children($element); $output .= '</div>'; $output .= render($hidden_elements); return $output; }
function cart_list() { $data = array(); if (!isset($_SESSION['cart'])) { $data['error'] = 'Giỏ trống trơn!'; } else { $data['cart'] = $_SESSION['cart']; $fromDB = model('book')->getCartList($data['cart']); $merge = array(); foreach ($data['cart'] as $cart) { foreach ($fromDB as $value) { if (intval($value['id']) == $cart['book_id']) { $merge[] = array_merge($cart, $value); } } } //var_dump($merge); $data['merge'] = $merge; } //Submit cart if (isPostRequest()) { $postData = postData(); for ($i = 1; $i <= count($_SESSION['cart']); $i++) { foreach ($_SESSION['cart'] as $key => $cart) { if ($postData['bookid' . $i] == $cart['book_id']) { $_SESSION['cart'][$key]['quantity'] = $postData['quantity' . $i]; } } } redirect('index.php?c=bill&m=view'); } $data['template_file'] = 'cart/list.php'; render('layout.php', $data); }
/** * Callback for preg_replace in process() */ public static function processCallback($matches = array()) { $content = ''; $entity_type = $entity_id = $view_mode = ''; foreach ($matches as $key => $match) { switch ($key) { case 1: $entity_type = $match; break; case 2: $entity_id = $match; break; case 3: $view_mode = $match; break; } } $entities = entity_load($entity_type, array($entity_id)); if (!empty($entities)) { $render_array = entity_view($entity_type, $entities, $view_mode, NULL, TRUE); // Remove contextual links. if (isset($render_array[$entity_type][$entity_id]['#contextual_links'])) { unset($render_array[$entity_type][$entity_id]['#contextual_links']); } $content = render($render_array); } return $content; }
function deco_preprocess_page(&$vars) { $vars['sidebar_triple'] = FALSE; if (!empty($vars['page']['sidebar_second']) && !empty($vars['page']['sidebar_right_sec']) && !empty($vars['page']['sidebar_first'])) { $vars['classes_array'][] .= ' sidebar-triple'; $vars['sidebar_triple'] = TRUE; } if (!empty($vars['page']['sidebar_right_sec']) && empty($vars['page']['sidebar_second'])) { $vars['page']['sidebar_second'] = $vars['page']['sidebar_right_sec']; $vars['page']['sidebar_right_sec'] = ''; } // set variables for the logo and slogan $site_fields = array(); if ($vars['site_name']) { $site_fields[] = check_plain($vars['site_name']); } if ($vars['site_slogan']) { $site_fields[] = '- ' . check_plain($vars['site_slogan']); } $vars['site_title'] = implode(' ', $site_fields); if (isset($site_fields[0])) { $site_fields[0] = '<span class="site-name">' . $site_fields[0] . '</span>'; } if (isset($site_fields[1])) { $site_fields[1] = '<span class="site-slogan">' . $site_fields[1] . '</span>'; } $vars['site_title_html'] = implode(' ', $site_fields); $vars['primary_menu'] = str_replace('class="menu"', 'class="links primary-links"', render(menu_tree(variable_get('menu_main_links_source', 'main-menu')))); $vars['secondary_menu'] = str_replace('class="menu"', 'class="links secondary-links"', render(menu_tree(variable_get('menu_secondary_links_source', 'secondary-menu')))); }
/** * Processes variables for the "bootstrap_modal" theme hook. * * See template for list of available variables. * * @see bootstrap-modal.tpl.php * * @ingroup theme_process */ function bootstrap_process_bootstrap_modal(&$variables) { $variables['attributes'] = drupal_attributes($variables['attributes']); $variables['dialog_attributes'] = drupal_attributes($variables['dialog_attributes']); $variables['body'] = render($variables['body']); $variables['footer'] = render($variables['footer']); }
function business_preprocess_render_panel(&$variables) { $page = $variables['page']; $panels_list = $variables['panels_list']; $regions_width = $variables['regions_width']; $variables = array(); $variables['page'] = array(); $variables['panel_width'] = $regions_width; $variables['panel_classes'] = array(); $variables['panels_list'] = $panels_list; $is_empty = TRUE; $panel_keys = array_keys($panels_list); foreach ($panels_list as $panel) { $variables['page'][$panel] = $page[$panel]; $panel_width = $regions_width[$panel]; if (render($page[$panel])) { $is_empty = FALSE; } $classes = array("panel-column"); $classes[] = "col-lg-{$panel_width}"; $classes[] = "col-md-{$panel_width}"; $classes[] = "col-sm-12"; $classes[] = "col-xs-12"; $classes[] = str_replace("_", "-", $panel); $variables['panel_classes'][$panel] = implode(" ", $classes); } $variables['empty_panel'] = $is_empty; }
/** * Preprocess variables for page.tpl.php * default variales for page.tpl.php: * $logo, $front_page, $site_name, $site_slogan, $messages * $title_prefix, $title_suffix, $tabs, $action_links * $feed_icons, $breadcrumb */ function water_preprocess_page(&$vars) { if (isset($vars['node'])) { // If the node type is "blog_madness" the template suggestion will be "page--blog-madness.tpl.php". $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type; if ($vars['node']->type == 'deprecated_organization') { //var_dump($vars['node']); //$vars['organization_geolocation'] = array($vars['node']->field_latitude['und']['0']['value'], $vars['node']->field_longitude['und']['0']['value']); /* * LOAD GMAPS MODULE */ //add html element 'organization-gmap-canvas' in template file that will hold Google map //Load gmap3_tools.inc file module_load_include('inc', 'gmap3_tools'); //all gmap3_tools_add_map() function from API file with appropriate map configuratio array gmap3_tools_add_map(array('mapId' => 'organization-gmap-canvas', 'mapOptions' => array('centerX' => -34.397, 'centerY' => 150.644, 'zoom' => 12), 'markers' => array(gmap3_tools_create_marker(-1, -1, 'Home', 'Home')), 'geocodeAddress' => $vars['node']->field_city['und']['0']['taxonomy_term']->name, 'gmap3ToolsOptions' => array('defaultMarkersPosition' => GMAP3_TOOLS_DEFAULT_MARKERS_POSITION_CENTER))); } //create a variable to hold rich title field added to specific content types $view = node_view($vars['node']); $vars['rich_title'] = render($view['field_rich_title']); } //var_dump($vars); //var_export($vars); //var_dump(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)); // $vars['contact_form'] = drupal_render(drupal_get_form('contact_site_form')); }