/** * Adds header. * * @param string $class * * @return View */ public function addHeader($class = 'Menu_Objective') { $this->header_wrap = $this->add('View', null, 'Header', array('layout/fluid', 'Header')); /** @type View $this->header_wrap */ $this->header = $this->header_wrap->add($class, null, 'Header_Content'); return $this->header; }
public function listar() { $dao = new Dao_Usuario(); $usuarios = $dao->request(); $view = new View(); $view->add('nomeUsuario', 'Alisson Chiquitto'); $view->add('usuarios', $usuarios); $view->desenhar('usuario/listar'); }
function add($class, $options = null, $spot = null, $template = null, $isMyform = false) { if (!$isMyform && $class != 'xepan\\hr\\Controller_ACL' && $this->form instanceof \Form) { return $this->form->layout->add($class, $options, $spot, $template); } return parent::add($class, $options, $spot, $template); }
public function addButton($label = 'Button', $name = null) { if ($this->layout && $this->layout->template->hasTag('FormButtons')) { $button = $this->layout->add('Button', $name, 'FormButtons'); } else { $button = $this->add('Button', $name, 'form_buttons'); } /** @type Button $button */ $button->setLabel($label); return $button; }
function raise_error($error) { // init the view library $view = new View(); // assign the error message $view->assign('error_msg', $error); // add the 'error' view $view->add('error'); // output view $view->output(); // end script execution exit; }
public function add($object, $sName = null, $bTakeover = true) { if ($object instanceof TransparentViewContainer) { if (!$sName) { $sName = $object->name(); } if (isset($this->arrChildContainers[$sName])) { throw new Exception("名称为:%s 的子视图在视图 %s 中已经存在,无法添加同名的子视图", array($sName, $this->name())); } $this->arrChildContainers[$sName] = $object; if ($bTakeover) { $object->setParent($this); } } else { parent::add($object, $sName, $bTakeover); } }
function retrieve_password() { $view = new View(); $user = $this->model->get_where(array('email' => @$_REQUEST['email'])); if ($user && is_array($user) && count($user) == 1) { $user = $user[0]; $id = $user['id']; unset($user['id']); $password = generatePassword(4); $this->model->update($id, array('password' => md5($password))); $user['password'] = $password; $email_data = array('title' => lang(MAIL_FROM_TITLE . ' - New Password'), 'date' => date('Y-m-d'), 'user' => $user); $content = $view->add('email/user-forgotpass', $email_data, TRUE); sendMail(lang(MAIL_FROM_TITLE . ' - Password Info'), $user['email'], $content); } return $user; }
public function __construct($path, $data, $root = "") { if ($root != "") { View::$root = $root; } $cache = View::get($path); if (!$cache) { $path = View::$root . $path; $fh = @fopen($path, "r"); if (!$fh) { throw new ErrorException("Missing file '" . $path . "'."); } $this->tplFileContent = fread($fh, filesize($path)); fclose($fh); View::add($path, $this->tplFileContent); } else { $this->tplFileContent = $cache; } $this->vars = $data; }
/** * Add a new View. Requires login * * @param string $name the name of the view * @param string $desc the description of the view * @param string $private optional, can be Y or N, defaults to users preferred setting. * @param string $nodetypeid optional, the id of the nodetype this node is, defaults to 'Idea' node type id. * @param string $groupid optional, the is of the group, if any, this view is in. * @param string $xpos optional, the x position to place the challenge node at (defaults to 0). * @param string $ypos optional, the y position to place the challenge node at (defaults to 0). * * @return Node or Error */ function addView($name, $desc, $private = "", $nodetypeid = "", $groupid = "", $xpos = 0, $ypos = 0) { global $USER; if ($private == "") { $private = $USER->privatedata; } $v = new View(); $view = $v->add($name, $desc, $private, $nodetypeid, $groupid, $xpos, $ypos); return $view; }
break; } if( !$tmpl->item ) { if( $tmpl->code == -1 && $tmpl->action == null ) { $tmpl->code = 0; } unset($tmpl->item); } else { $tmpl->breadcrumb = new Breadcrumb('item', $tmpl->item->itemid); View::add($_SESSION['userid'], $tmpl->item->itemid); $usr = User::getByID($_SESSION['userid']); $tmp = array_slice($usr->Predict->recommend($tmpl->item), 0, 6); $tmpl->recommendations = array(); foreach( $tmp as $rec ) { array_push($tmpl->recommendations, Item::getByID($rec['itemid'])); } } switch( $tmpl->code ) { case 0: $tmpl->message = "Could not find item."; $tmpl->css = "error"; break;
<?php require_once '#/bootstrap.php'; if (isset($_GET["debug"])) { $_SESSION["debug"] = $_GET["debug"]; } if (isset($_GET['event']) && !empty($_GET['event']) && ($event = preg_split('/_/', $_GET["event"], 2))) { $controller = $event[0]; $action = $event[1]; } else { $controller = "main"; $action = "index"; } try { init($controller, $action); } catch (Exception $e) { $controller = new Controller(); if (get_class($e) == "AssertException") { $controller->logger->warn($e->getMessage(), $e); } else { $controller->logger->fatal($e->getMessage(), $e); } if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { ob_end_clean(); echo Controller::showAjaxError($e->getMessage()); } else { $view = new View('error'); $view->add("error", array("message" => $e->getMessage())); $view->render(); } }
/** * @todo Description * * @param View $v */ public function showIntro($v) { /** @type H1 $h */ $h = $v->add('H1'); $h->set('Welcome to Web Software'); /** @type P $p */ $p = $v->add('P'); $p->set('Thank you for downloading this software. ' . 'This wizard will guide you through the installation procedure.'); /** @type View_Warning $w */ $w = $v->add('View_Warning'); if (!is_writable('.')) { $w->setHTML('This installation does not have permissions to create your ' . '<b>config.php</b> file for you. You will need to manually create this file'); } elseif (file_exists('config.php')) { $w->setHTML('It appears that you already have <b>config.php</b> file in your ' . 'application folder. This installation will read defaults from config.php, but it will ultimatelly ' . '<b>overwrite</b> it with the new settings.'); } /** @type Button $b */ $b = $v->add('Button'); $b->set('Start')->js('click')->univ()->location($this->stepURL('first')); }
<?php function __autoload($class_name) { include 'src/' . $class_name . '.php'; } // name of render to use from POST $render = isset($_POST['render']) ? $_POST['render'] : "RenderImage"; // shapes to draw with params from POST $shapes = isset($_POST['shapes']) ? $_POST['shapes'] : [['type' => 'circle', 'params' => ['width' => 1, 'color' => 'red']], ['type' => 'square', 'params' => ['width' => 0.5, 'color' => 'blue']]]; $View = new View($render); foreach ($shapes as $shape_data) { $shape = ShapeFactory::build($shape_data['type'], $shape_data['params']); $View->add($shape); } $View->render();
if (file_exists('./cfg/db.php') && filesize('./cfg/db.php') > 43) { $view->message($lang['ban']); } #PDO drivers $dr = PDO::getAvailableDrivers(); $my = in_array('mysql', $dr); $li = in_array('sqlite', $dr); #No driver if (!$my && !$li) { $view->message($lang['noDB']); } #Only one $one = ($li xor $my) ? $my ? 'mysql' : 'sqlite' : false; #Check CHMOD if (!$setup->chmods()) { $view->add('chmod', array('chmod' => $setup->buildChmodTable())); } else { switch (isset($_POST['stage']) ? $_POST['stage'] : ($one ? 1 : 0)) { #Install case 2: $type = isset($_POST['file']) ? 'sqlite' : 'mysql'; $data = array('type' => $type, 'host' => $type == 'mysql' ? htmlspecialchars($_POST['host']) : '', 'db' => $type == 'mysql' ? htmlspecialchars($_POST['db']) : '', 'user' => $type == 'mysql' ? htmlspecialchars($_POST['user']) : '', 'pass' => $type == 'mysql' ? htmlspecialchars($_POST['pass']) : '', 'file' => $type == 'sqlite' ? htmlspecialchars($_POST['file']) : '', 'skin' => htmlspecialchars($_POST['skin']), 'title' => htmlspecialchars($_POST['title']), 'pre' => htmlspecialchars($_POST['pre']), 'login' => htmlspecialchars($_POST['login']), 'urls' => (int) $_POST['urls'], 'lng' => (int) $_POST['lng']); #Prefix define('PRE', $data['pre']); if (!preg_match('/^[a-zA-Z_]{0,9}$/', PRE)) { $error[] = $lang['e1']; } #Wrong password if (!isset($_POST['uPass'][4])) { $error[] = $lang['e2']; }
/** * Add variables to view * * @param string $name view variable name * @param mixed $value * @return void */ public function add($name, $value) { $this->view->add($name, $value); }