本文整理汇总了PHP中template::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP template::assign方法的具体用法?PHP template::assign怎么用?PHP template::assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类template
的用法示例。
在下文中一共展示了template::assign方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$tpl = new template();
$id = (int) $_GET['id'];
if ($id > 0) {
$lead = $this->getLead($id);
// Comments
$comments = new comments();
if (isset($_POST['comment']) === true) {
$values = array('text' => $_POST['text'], 'date' => date("Y-m-d H:i:s"), 'userId' => $_SESSION['userdata']['id'], 'moduleId' => $id, 'commentParent' => $_POST['father']);
$comments->addComment($values, 'lead');
}
// files
$file = new files();
if (isset($_POST['upload'])) {
if (isset($_FILES['file'])) {
$file->upload($_FILES, 'lead', $id);
$tpl->setNotification('FILE_UPLOADED', 'success');
} else {
$tpl->setNotification('NO_FILE', 'error');
}
}
$files = new files();
$tpl->assign('files', $files->getFilesByModule('lead', $id));
$tpl->assign('comments', $comments->getComments('lead', $id));
$tpl->assign('contactInfo', $this->getLeadContact($id));
$tpl->assign('lead', $lead);
} else {
$tpl->display('general.error');
}
$tpl->display('leads.showLead');
}
示例2: run
/**
* run - display template and edit data
*
* @access public
*/
public function run()
{
$tpl = new template();
$helper = new helper();
$values = array('description' => '', 'dateFrom' => '', 'dateTo' => '', 'allDay' => '');
if (isset($_POST['save']) === true) {
if (isset($_POST['allDay']) === true) {
$allDay = 'true';
} else {
$allDay = 'false';
}
if (isset($_POST['dateFrom']) === true && isset($_POST['timeFrom']) === true) {
$dateFrom = $helper->date2timestamp($_POST['dateFrom'], $_POST['timeFrom']);
}
if (isset($_POST['dateTo']) === true && isset($_POST['timeTo']) === true) {
$dateTo = $helper->date2timestamp($_POST['dateTo'], $_POST['timeTo']);
}
$values = array('description' => $_POST['description'], 'dateFrom' => $dateFrom, 'dateTo' => $dateTo, 'allDay' => $allDay);
if ($values['description'] !== '') {
if ($helper->validateTime($_POST['timeFrom']) === true) {
$this->addEvent($values);
$msgKey = $tpl->setNotification('SAVE_SUCCESS', 'success');
} else {
$tpl->setNotification('WRONG_TIME_FORMAT', 'error');
}
} else {
$tpl->setNotification('NO_DESCRIPTION', 'error');
}
$tpl->assign('values', $values);
}
$tpl->assign('helper', $helper);
$tpl->display('calendar.addEvent');
}
示例3: run
/**
* run - display template and edit data
*
* @access public
*/
public function run()
{
$tpl = new template();
//Only admins
if ($_SESSION['userdata']['role'] == 'admin') {
if (isset($_GET['id']) === true) {
$id = (int) $_GET['id'];
$msgKey = '';
if ($this->hasTickets($id) === true) {
$msgKey = 'CLIENT_HAS_TICKETS';
} else {
if (isset($_POST['del']) === true) {
$this->deleteClient($id);
$msgKey = 'CLIENT_DELETED';
}
}
//Assign vars
$tpl->assign('client', $this->getClient($id));
$tpl->assign('msg', $msgKey);
$tpl->display('clients.delClient');
} else {
$tpl->display('general.error');
}
} else {
$tpl->display('general.error');
}
}
示例4: form_builder_content_handler
function form_builder_content_handler(&$sm)
{
$um =& $sm->get_url_manager();
$sm->set_theme();
$sm->_template->set_template_file(VIVVO_FS_ROOT . VIVVO_TEMPLATE_DIR . 'frame/default.tpl');
$content_template = new template($sm, $sm->_template);
require_once dirname(__FILE__) . '/form_builder.class.php';
$form_list =& new FormBuilderForms_list($sm);
$form =& $form_list->get_form_by_id($um->get_param('search_fid'));
$content_template->assign('form', $form);
if ($form) {
$form_element_list =& new FormBuilderFields_list($sm);
$form_element_list->get_elements_by_form_id($form->id);
$upload = false;
foreach ($form_element_list->list as $element) {
if ($element->get_type() == 'file_upload') {
$upload = true;
break;
}
}
$content_template->assign('form_elements', $form_element_list->list);
$content_template->assign('form_has_file_upload', $upload);
}
$action = $um->get_param('action');
if ($upload && !empty($action)) {
if (!empty($form->message_url)) {
$content_template->assign('message_url', $form->message_url);
}
$content_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'box/plugin_form_builder.tpl');
} else {
$content_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'system/box_default/box_form.tpl');
}
$sm->_template->assign_template('PAGE_CONTENT', $content_template);
}
示例5: run
/**
* run - display template and edit data
*
* @access public
*
*/
public function run()
{
$tpl = new template();
$tpl->assign('role', $_SESSION['userdata']['role']);
$tpl->assign('allProjects', $this->getUserProjects());
$tpl->display('projects.showAll');
}
示例6: run
/**
* run - display template and edit data
*
* @access public
*
*/
public function run()
{
$tpl = new template();
$infoKey = '';
//Build values array
$values = array('name' => '', 'alias' => '', 'modules' => array());
if (isset($_POST['save'])) {
$modules = '';
foreach ($_POST['modules'] as $row) {
$modules .= $row . ',';
}
$values = array('name' => $_POST['name'], 'alias' => $_POST['alias'], 'modules' => $modules);
if ($values['name'] !== '') {
$helper = new helper();
if ($values['alias'] !== '') {
$this->newSystemOrg($values);
$infoKey = '<p>Erfolgreich hinzugefügt</p>';
$values['modules'] = explode(',', $values['modules']);
} else {
$infoKey = 'Keine Beschreibung angegeben';
}
} else {
$infoKey = 'Keinen Alias angegeben';
}
}
//Assign vars
$tpl->assign('modules', $this->getAllModules());
$tpl->assign('info', $infoKey);
$tpl->assign('values', $values);
$tpl->display('setting.newSystemOrg');
}
示例7: run
/**
* run - display template and edit data
*
* @access public
*
*/
public function run()
{
$tpl = new template();
//Only Admins
if ($_SESSION['userdata']['role'] == 'admin') {
if (isset($_GET['id']) === true) {
$id = (int) $_GET['id'];
$user = $this->getUser($id);
$msgKey = '';
//Delete User
if (isset($_POST['del']) === true) {
$this->deleteUser($id);
$msgKey = 'USER_DELETED';
}
//Assign variables
$tpl->assign('msg', $msgKey);
$tpl->assign('user', $user);
$tpl->display('users.delUser');
} else {
$tpl->display('general.error');
}
} else {
$tpl->display('general.error');
}
}
示例8: run
public function run()
{
// Hier instanzieren wir die Template Engine
$tpl = new template();
$users = $this->getUsers();
$user = '';
if (isset($_POST['user']) === true && $_POST['user'] != "") {
$user = htmlentities($_POST['user']);
}
if (isset($_POST['save']) === true && $_POST['save'] != "") {
if (isset($_POST['menu']) === true) {
$menu = $_POST['menu'];
} else {
$menu = array();
}
$info = 'Änderungen gespeichert';
$this->deleteAllRelations($user);
$this->insertRelations($menu, $user);
} else {
$info = '';
}
$tpl->assign('users', $users);
$tpl->assign('user', $user);
$tpl->assign('info', $info);
$tpl->assign('menu', $this->getMenu($user));
$tpl->display('setting.userMenu');
}
示例9: show
function show($view, $loc = null, $title = '')
{
if (pathos_permissions_check('administrate', $loc) || pathos_permissions_check('create', $loc) || pathos_permissions_check('edit', $loc) || pathos_permissions_check('delete', $loc)) {
$template = new template('htmltemplatemodule', $view, $loc);
if (!defined('SYS_FILES')) {
require_once BASE . 'subsystems/files.php';
}
$directory = 'files/htmltemplatemodule/' . $loc->src;
if (!file_exists(BASE . $directory)) {
$err = pathos_files_makeDirectory($directory);
if ($err != SYS_FILES_SUCCESS) {
$template->assign('noupload', 1);
$template->assign('uploadError', $err);
}
}
global $db;
$templates = $db->selectObjects('htmltemplate');
for ($i = 0; $i < count($templates); $i++) {
$assocs = $db->selectObjects('htmltemplateassociation', 'template_id=' . $templates[$i]->id);
if (count($assocs) == 1 && $assocs[0]->global == 1) {
$templates[$i]->global_assoc = 1;
} else {
$templates[$i]->global_assoc = 0;
$templates[$i]->associations = $assocs;
}
}
$template->assign('moduletitle', $title);
$template->assign('templates', $templates);
$template->register_permissions(array('administrate', 'create', 'edit', 'delete'), pathos_core_makeLocation('htmltemplatemodule'));
$template->output();
}
}
示例10: run
/**
* run - display template and edit data
*
* @access public
*
*/
public function run()
{
$tpl = new template();
$infoKey = '';
//Build values array
$values = array('name' => '', 'parent' => '', 'module' => '', 'action' => '', 'icon' => '');
if (isset($_POST['save'])) {
if (isset($_POST['module'])) {
$module = str_replace('index.php?act=', '', $_POST['module']);
$module = explode('.', $module);
$action = $module[1];
$module = $module[0];
$values = array('name' => $_POST['name'], 'parent' => $_POST['parent'], 'module' => $module, 'action' => $action, 'icon' => $_POST['icon']);
$this->addMenu($values);
$tpl->setNotification('New menu item successfully created', 'success');
// $infoKey = '<p>Erfolgreich hinzugefügt</p>';
} else {
$tpl->setNotification('MISSING_FIELDS', 'error');
}
}
$getModuleLinks = $this->getAllModulesAsLinks();
$tpl->assign('wholeMenu', $this->getWholeMenu());
$tpl->assign('moduleLinks', $getModuleLinks);
$tpl->assign('info', $infoKey);
$tpl->assign('values', $values);
$tpl->assign('applications', $this->applications);
$tpl->display('setting.addMenu');
}
示例11: run
public function run()
{
$tpl = new template();
$language = new language();
$language->setModule('leads');
$language->readIni();
if (isset($_POST['save'])) {
if (isset($_POST['name']) && isset($_POST['money']) && isset($_POST['referralSource'])) {
$refValue = '';
if ($_POST['referralValueOther'] != '') {
$refValue = $_POST['referralValueOther'];
} else {
if ($_POST['referralSource'] == 5 && $_POST['referralValueClient'] > 0) {
$refValue = $_POST['referralValueClient'];
}
}
$values = array('name' => $_POST['name'], 'refSource' => $_POST['referralSource'], 'refValue' => $refValue, 'potentialMoney' => $_POST['money'], 'creatorId' => $_SESSION['userdata']['id']);
$contact = array('name' => $_POST['clientName'], 'street' => $_POST['street'], 'zip' => $_POST['zip'], 'city' => $_POST['city'], 'state' => $_POST['state'], 'country' => $_POST['country'], 'phone' => $_POST['phone'], 'email' => $_POST['email'], 'internet' => $_POST['internet']);
if ($this->isLead($values['name']) !== true) {
$leadId = $this->addLead($values);
$this->addLeadContact($contact, $leadId);
$tpl->setNotification('EDIT_SUCCESS', 'success');
} else {
$tpl->setNotification('LEAD_EXISTS', 'error');
}
} else {
$tpl->setNotification('MISSING_FIELDS', 'error');
}
}
$client = new clients();
$tpl->assign('referralSources', $this->getReferralSources());
$tpl->assign('clients', $client->getAll());
$tpl->display('leads.addLead');
}
示例12: run
/**
* run - display template and edit data
*
* @access public
*
*/
public function run()
{
$tpl = new template();
$action = base64_decode($_GET['action']);
$infoKey = '';
$roles = $this->getRoles();
$tabRights = $this->getTabRights($action);
if (isset($_POST['saveTabs'])) {
$i = 0;
foreach ($tabRights as $key => $value) {
if (isset($_POST['' . $key . '-select']) === true) {
$arrayRoles = $_POST['' . $key . '-select'];
$moduleRoles = '';
foreach ($_POST['' . $key . '-select'] as $row2) {
$moduleRoles .= $row2 . '|';
}
$values[$i]['action'] = $action;
$values[$i]['tab'] = $key;
$values[$i]['tabRights'] = $moduleRoles;
$i++;
}
}
$this->saveTabRights($action, $values);
$infoKey = "Tab Rechte gespeichert";
$tabRights = $this->getTabRights($action);
}
//Assign vars
$tpl->assign('action', $action);
$tpl->assign('tabArray', $tabRights);
$tpl->assign('roles', $roles);
$tpl->assign('info', $infoKey);
$tpl->display('setting.editTabRights');
}
示例13: run
public function run()
{
$tpl = new template();
$id = (int) $_GET['id'];
$users = new users();
$clients = new clients();
if ($id && $id > 0) {
$lead = $this->getLead($id);
$contact = $this->getLeadContact($id);
$values = array('user' => $contact['email'], 'password' => '', 'firstname' => '', 'lastname' => '', 'phone' => $contact['phone'], 'role' => 3, 'clientId' => $lead['clientId']);
if (isset($_POST['save'])) {
if (isset($_POST['user']) && isset($_POST['firstname']) && isset($_POST['lastname'])) {
$hasher = new PasswordHash(8, TRUE);
$values = array('user' => $_POST['user'], 'password' => $hasher->HashPassword($_POST['password']), 'firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname'], 'phone' => $_POST['phone'], 'role' => $_POST['role'], 'clientId' => $_POST['clientId']);
if ($users->usernameExist($values['user']) !== true) {
$users->addUser($values);
$tpl->setNotification('USER_CREATED', 'success');
} else {
$tpl->setNotification('USERNAME_EXISTS', 'error');
}
} else {
$tpl->setNotification('MISSING_FIELDS', 'error');
}
}
$tpl->assign('values', $values);
$tpl->assign('clients', $clients->getAll());
$tpl->assign('roles', $users->getRoles());
$tpl->display('leads.convertToUser');
} else {
$tpl->display('general.error');
}
}
示例14: show
function show($view, $loc, $title = '')
{
$template = new template('imagemanagermodule', $view, $loc);
$uilevel = 99;
// MAX
if (exponent_sessions_isset("uilevel")) {
$uilevel = exponent_sessions_get("uilevel");
}
$template->assign('show', defined('SELECTOR') || $uilevel > UILEVEL_PREVIEW ? 1 : 0);
if (!defined('SYS_FILES')) {
include_once BASE . 'subsystems/files.php';
}
$directory = 'files/imagemanagermodule/' . $loc->src;
if (!file_exists(BASE . $directory)) {
$err = exponent_files_makeDirectory($directory);
if ($err != SYS_FILES_SUCCESS) {
$template->assign('noupload', 1);
$template->assign('uploadError', $err);
}
}
global $db;
$location = serialize($loc);
if (!isset($_SESSION['image_cache'][$location])) {
$items = $db->selectObjects("imagemanageritem", "location_data='" . serialize($loc) . "'");
$_SESSION['image_cache'][$location] = $items;
} else {
$items = $_SESSION['image_cache'][$location];
}
$files = $db->selectObjectsIndexedArray("file", "directory='{$directory}'");
$template->assign('items', $items);
$template->assign('files', $files);
$template->assign('moduletitle', $title);
$template->register_permissions(array('administrate', 'post', 'edit', 'delete'), $loc);
$template->output();
}
示例15: run
public function run()
{
$tpl = new template();
$tpl->assign('menu', $this);
$tpl->assign('menus', $this->getMenus());
$tpl->display('general.menu');
}