/** * @param IHtmlElement[] $nodes * @param int $width (1 -12) * @param bool $autoAdjust * @param int|bool $paddingLeft (1- 12) * @param int|bool $mdWidth */ public function addContent(array $nodes, $width = 12, $autoAdjust = true, $paddingLeft = false, $mdWidth = false) { //todo if ($this->container == null) { $div = new div(); //$div->addClasses("container"); $this->addChildren($div); $this->container = $div; } if ($mdWidth === false) { $mdWidth = $width; if ($autoAdjust) { $mdWidth = 2 * $mdWidth; if ($mdWidth > 12) { $mdWidth = 12; } } } $div = new div(); /*$div->addClass("col-lg-" . $width); $div->addClass("col-md-" . $mdWidth);*/ if (is_numeric($paddingLeft)) { //$div->addClass("col-lg-offset-" . $paddingLeft); } $div->addChildren($nodes); $this->container->addChildren($div); }
public function __construct() { # $this->translationData = div::getCsvFromFile('/var/www/a1217/html/typo3/fileadmin/xlfImages/locallang.csv', 0, ',', '"', '\\', TRUE); $basedir = str_replace('/html/typo3/', '', getcwd()); $this->translationData = div::getCsvFromFile($basedir . '/fileadmin/xlfImages/locallang.csv', 0, ',', '"', '\\', TRUE); // echo '<pre>'; // print_r($this->translationData); // echo '</pre>'; }
function getContent() { $menu = array(); if (isset($GLOBALS['MODULECONF']['menu'][$this->type])) { foreach ($GLOBALS['MODULECONF']['menu'][$this->type] as $k => $v) { $link = div::link(isset($v[0]) ? $v[0] : '', isset($v[2]) ? div::explodeStringForLink($v[2]) : array(), $v[1] ? $v[1] : ''); $menu[] = array('NAME' => $k, 'LIEN' => $link, 'notlast?' => true, 'link_selected?' => $v[0] == $this->module && $v[1] == $this->type && !isset($v[2]) ? true : false); } end($menu); $menu[key($menu)]['notlast?'] = false; } $marker = array('menu' => $menu); return $this->template->nestedMarkerArray($marker, 'MENU_PART'); }
/** * * * @param * @access public * @return void */ function getReservation($depart, $arrivee, $horaire) { $reservation = array(); foreach ($this->reservation as $k => $v) { if (isset($v['code_arret'][0]) && isset($v['code_arret'][1]) && $v['horaire'] && $v['code_arret'][0] == $depart && $v['code_arret'][1] == $arrivee && $v['horaire'] == $horaire) { $reservation = $v; $h = div::makehoraire($v['horaire'], 'd/m/Y H:i:s'); $reservation['code_depart'] = $v['code_arret'][0]; $reservation['code_arrivee'] = $v['code_arret'][1]; $reservation['arrivee'] = isset($this->arrets[$v['code_arret'][1]]) ? $this->arrets[$v['code_arret'][1]]['lib_arret'] : ''; $reservation['depart'] = isset($this->arrets[$v['code_arret'][0]]) ? $this->arrets[$v['code_arret'][0]]['lib_arret'] : ''; $reservation['arrivee'] = isset($this->arrets[$v['code_arret'][1]]) ? $this->arrets[$v['code_arret'][1]]['lib_arret'] : ''; $reservation['horaire_arrivee'] = !isset($v['horaire_audepart']) || !$v['horaire_audepart'] ? $h : ''; $reservation['horaire_depart'] = isset($v['horaire_audepart']) && $v['horaire_audepart'] ? $h : ''; } } return $reservation; }
/** * * * @param * @access public * @return void */ public function link($addParams = array(), $urlRewrite = null, $module = null, $type = null) { if (is_null($module)) { $module = $this->module; } if (is_null($type)) { $type = $this->type; } return div::link($module, $addParams, $type, $urlRewrite); }
/** * * * @param * @access public * @return void */ function getContent() { $marker = array('lignes' => $this->getMarkersLignes(), 'json' => div::to_json($this->Treelignes), 'resultat' => $this->getResultats(), 'url' => $this->link()); return $this->template->nestedMarkerArray($marker, 'MAIN_PART'); }
/** * * * @param * @access public * @return void */ function getMarkersVoyage() { $markers = array(); foreach ($this->voyage as $k => $v) { $depart = isset($v['code_arret'][0]) ? $v['code_arret'][0] : 0; $arrivee = isset($v['code_arret'][1]) ? $v['code_arret'][1] : 0; $horaire = div::makehoraire($v['horaire'], 'd/m/Y H:i:s'); $markers[] = array('depart' => isset($this->arrets[$depart]) ? $this->arrets[$depart]['lib_arret'] : '', 'arrivee' => isset($this->arrets[$arrivee]) ? $this->arrets[$arrivee]['lib_arret'] : '', 'debut_periode' => isset($v['periode']['debut_periode']) ? div::makehoraire($v['periode']['debut_periode'], 'd/m/Y') : '', 'fin_periode' => isset($v['periode']['fin_periode']) ? div::makehoraire($v['periode']['fin_periode'], 'd/m/Y') : '', 'nb_personnes' => isset($v['nb_personnes']) ? $v['nb_personnes'] : 0, 'horaire_arrivee' => !isset($v['horaire_audepart']) || !$v['horaire_audepart'] ? $horaire : '', 'horaire_depart' => isset($v['horaire_audepart']) && $v['horaire_audepart'] ? $horaire : '', 'horaire' => $horaire, 'activation' => $this->getActivationVoyage($v)); } return $markers; }
/** * * * @param * @access private * @return void */ private function markerPeriod($periode) { $marker = array(); foreach ($periode as $plageHorraire) { $depart = ''; $arrivee = ''; if (isset($plageHorraire['periode'])) { $depart = isset($plageHorraire['periode']['debut_periode']) ? $plageHorraire['periode']['debut_periode'] : (isset($plageHorraire['periode']['fin_periode']) ? $plageHorraire['periode']['fin_periode'] : ''); } if (isset($plageHorraire['periode[1]'])) { $arrivee = isset($plageHorraire['periode[1]']['fin_periode']) ? $plageHorraire['periode[1]']['fin_periode'] : (isset($plageHorraire['periode[1]']['debut_periode']) ? $plageHorraire['periode[1]']['debut_periode'] : ''); } $marker[] = array('depart' => $depart ? div::makehoraire($depart, 'd/m/Y H:i:s') : $depart, 'arrivee' => $arrivee ? div::makehoraire($arrivee, 'd/m/Y H:i:s') : $arrivee); } //div::debug($marker, 'markerPeriod'); return array('resultat_ligne' => $marker); }
<?php /** * Div PHP Template Engine Example */ // Include the lib include "div.php"; // Custom function function t($word) { $dict = array('ejemplo basico' => 'basic example'); if (isset($dict[strtolower($word)])) { return $dict[strtolower($word)]; } return $word; } div::setAllowedFunction("t"); // Custom parser/subparser function a($href) { return '<a href = "' . $href . '">' . $href . '</a>'; } div::setSubParser("a"); // Output echo new div("example.tpl", array("title" => "Ejemplo basico", "year" => "2015", "links" => array("Core" => "http://github.com/rafageist/div", "Extras" => "http://github.com/rafageist/div-extras")));
/** * * * @param * @access public * @return void */ function getContentLogin() { $this->titlePage = 'Connexion'; $marker = array('url_login' => div::link($this->redirect['module'], array(), $this->redirect['type'])); return $this->template->nestedMarkerArray($marker, 'LOGIN_PART'); }
function buildTable($aData) { //Get column names from array key $colNames = array_keys($aData); //Initalize Div "Table" object $divParts = new div(); //Begin Table $divTable .= $divParts->div("Table"); //Begin Header of table $divTable .= $divParts->div("Header"); //for each column create a new cell with the names of the columns foreach ($colNames as $colName) { $divTable .= $divParts->div("Cell", "{$colName}"); $divTable .= $divParts->endDiv(); } //End Header $divTable .= $divParts->endDiv(); //For each row of data foreach ($aData as $row) { //Start divRow $divTable .= $divParts->div("Row"); //For each column in the row foreach ($row as $cell) { $divTable .= $divParts->div("Cell", "{$cell}"); $divTable .= $divParts->endDiv(); } //End divRow $divTable .= $divParts->endDiv(); } //End divTable $divTable .= $divParts->endDiv(); //return finished table //return $divTable; echo $divTable; }
/** * * * @param * @access public * @return void */ function processDateSubpart_callback($match) { /* Declare */ $dateFormat = $match[1]; $format = false; $date = trim($match[2]); $res = ''; /* Begin */ if (div::testInt($date)) { $date = intval($date); } else { $date = strtotime($date); } if (strpos($dateFormat, ':')) { list($dateFormat, $format) = explode(':', $dateFormat, 2); } switch ($dateFormat) { case 'strftime': $res = strftime($format, $date); break; case 'date': $res = date($format, $date); break; } return $res; }
/** * * * @param * @access public * @return void */ protected function getmarkerArray() { $content = ''; $title = ''; //pour le cas d'une réécriture d'url if (isset($_SERVER['PATH_INFO']) && trim($_SERVER['PATH_INFO'])) { $info = explode('/', trim($_SERVER['PATH_INFO'])); if (trim($_SERVER['PATH_INFO']) != '/') { if (isset($info[1]) && trim($info[1]) && ($info[1] == 'declic' || $info[1] == 'pixel')) { $type = trim($info[1]); $module = isset($info[2]) && trim($info[2]) ? trim($info[2]) : ''; } else { $type = ''; $module = isset($info[1]) && trim($info[1]) ? trim($info[1]) : ''; } } else { $module = $GLOBALS['SITECONF']['CONFIG']['defaultModule']; $type = $GLOBALS['SITECONF']['CONFIG']['defaultType']; } } elseif (isset($_GET['module']) && trim($_GET['module'])) { $module = trim($_GET['module']); $type = isset($_GET['type']) && trim($_GET['type']) ? trim($_GET['type']) : ''; } else { $module = $GLOBALS['SITECONF']['CONFIG']['defaultModule']; $type = $GLOBALS['SITECONF']['CONFIG']['defaultType']; } if (!div::moduleExist($module, $type)) { $module = 'error404'; $type = ''; } if (div::redirectAuth($module, $type)) { $redirect = array('type' => $type, 'module' => $module == 'authentification' ? $GLOBALS['SITECONF']['CONFIG']['defaultModule'] : $module); $module = 'authentification'; $path = PATH_MODULE; $path .= $module . '/'; $className = 'm_' . $module; require_once $path . $className . '.php'; $class = new $className('', $module); $content = $class->main($redirect); $title = $class->titlePage; } else { $path = PATH_MODULE; if ($type) { $path .= $type . '/'; } $path .= $module . '/'; $className = 'm_' . $module; require_once $path . $className . '.php'; $class = new $className($type, $module); $content = $class->main(); $title = $class->titlePage; } $currentType = $type ? $type : (isset($class->type) ? $class->type : ''); $markerArray = array('title' => $title, 'content' => $content, 'header' => headmgr::getHeader()); if (isset($GLOBALS['CONF']['addMarker'])) { foreach ($GLOBALS['CONF']['addMarker'] as $k => $v) { $markerArray[$k] = div::callUserFunc($v, array($type, $module, $currentType), $this); } } return $markerArray; }
function BuildMail() { // build the headers $this->headers = ""; // $this->xheaders['To'] = implode( ", ", $this->sendto ); if (count($this->acc) > 0) { $this->xheaders['CC'] = implode(", ", $this->acc); } if (count($this->abcc) > 0) { $this->xheaders['BCC'] = implode(", ", $this->abcc); } if ($this->receipt) { if (isset($this->xheaders["Reply-To"])) { $this->xheaders["Disposition-Notification-To"] = $this->xheaders["Reply-To"]; } else { $this->xheaders["Disposition-Notification-To"] = $this->xheaders['From']; } } if ($this->charset != "") { $this->xheaders["Mime-Version"] = "1.0"; $this->xheaders["Content-Type"] = "text/html; charset={$this->charset}"; $this->xheaders["Content-Transfer-Encoding"] = 'quoted-printable'; } $this->xheaders["X-Mailer"] = "Php/libMailv1.3"; // include attached files if (count($this->aattach) > 0) { $this->_build_attachement(); } else { $this->fullBody = div::quoted_printable($this->body); } reset($this->xheaders); while (list($hdr, $value) = each($this->xheaders)) { if ($hdr != "Subject") { $this->headers .= "{$hdr}: {$value}\n"; } } }
/** * Switch ON the debug mode * * @param string $log_file */ static final function logOn($log_file = 'div.log') { self::$__log_mode = true; self::$__log_file = $log_file; self::log('Starting div with logs...'); }
/** * * * @param * @access public * @return void */ public function initUserByCodeAdherent($code) { $param = array('code_adherent' => $code); $reponse = $this->webtod->getResponseParse('adherent', 'ServiceLireAdherent', $param, 'LireAdherent', 'ServiceLireAdherent_Response.xml'); if (!$this->userExist($reponse)) { $this->logout(); return false; } $this->code_adherent = $code; $this->informations = $reponse['body']['adherent']; $this->informations['autorise_dz'] = div::boolval($this->informations['autorise_dz']); $this->informations['autorise_lv'] = div::boolval($this->informations['autorise_lv']); $_SESSION['user']['code_adherent'] = $this->code_adherent; $_SESSION['user']['informations'] = $this->informations; return true; }
/** * * * @param * @access public * @return void */ public static function callUserFunc($userFunc, $params, &$ref = null) { return call_user_func(div::getCallableFromStringUserFunc($userFunc, $ref), $params, $ref); }