本文整理汇总了PHP中Template_Helper类的典型用法代码示例。如果您正苦于以下问题:PHP Template_Helper类的具体用法?PHP Template_Helper怎么用?PHP Template_Helper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Template_Helper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __invoke
public function __invoke(Template_Helper $tpl)
{
$units = array('hour' => 'Hours', 'day' => 'Days');
$type_list = array('phone' => 'Phone Calls', 'note' => 'Notes', 'email' => 'Email', 'draft' => 'Drafts', 'time' => 'Time Tracking', 'reminder' => 'Reminders');
$tpl->assign(array('units' => $units, 'users' => Project::getUserAssocList($this->prj_id, 'active', User::ROLE_CUSTOMER), 'developer' => $this->usr_id, 'type_list' => $type_list, 'activity_types' => $this->activity_types ?: array_keys($type_list), 'unit' => $this->unit, 'amount' => $this->amount, 'start_date' => $this->start_date, 'end_date' => $this->end_date, 'sort_order' => $this->sort_order));
if (!$this->unit && !$this->amount) {
return;
}
$data = array();
if (in_array('phone', $this->activity_types)) {
$data['phone'] = $this->phoneActivity();
}
if (in_array('note', $this->activity_types)) {
$data['note'] = $this->noteActivity();
}
if (in_array('email', $this->activity_types)) {
$data['email'] = $this->emailActivity();
}
if (in_array('draft', $this->activity_types)) {
$data['draft'] = $this->draftActivity();
}
if (in_array('time', $this->activity_types)) {
$data['time'] = $this->timeActivity();
}
if (!$this->developer && in_array('reminder', $this->activity_types)) {
$data['reminder'] = $this->reminderActivity();
}
$tpl->assign(array('data' => $data, 'developer' => $this->developer));
}
示例2: rssError
function rssError($msg)
{
$tpl = new Template_Helper();
$tpl->setTemplate('rss_error.tpl.xml');
header('Content-Type: text/xml; charset=' . APP_CHARSET);
$tpl->assign(array('error' => $msg));
$tpl->displayTemplate();
}
示例3: make
public static function make($view, $vars = array(), $layout = true)
{
if (is_bool($layout)) {
if ($layout) {
$tpl = Template_Helper::getInstance(APP_PATH . 'View/layout.html');
} else {
$tpl = Template_Helper::getInstance(APP_PATH . 'View/no-layout.html');
}
} else {
$tpl = Template_Helper::getInstance(APP_PATH . 'View/' . $layout . '.html');
}
$file_view = realpath(APP_PATH . 'View/' . str_replace('.', '/', $view) . '.html');
$tpl->addFile('CONTENT', $file_view);
if (!empty($vars)) {
foreach ($vars as $var => $value) {
if (is_array($value)) {
foreach ($value as $object) {
foreach ($object as $bvar => $bvalue) {
$bvar = strtoupper($bvar);
$tpl->{$bvar} = $bvalue;
}
$tpl->block($var);
}
} else {
$tpl->{$var} = $value;
}
}
}
$tpl->show();
}
示例4: render_template
public static function render_template($path = null, $name = null, $params = null)
{
$html = '';
ob_start();
Template_Helper::get_template($path, $name, $params);
$html .= ob_get_contents();
ob_get_clean();
return $html;
}
示例5: dirname
// | Copyright (c) 2008 - 2010 Sun Microsystem Inc. |
// | Copyright (c) 2011 - 2013 Eventum Team. |
// | |
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to: |
// | |
// | Free Software Foundation, Inc. |
// | 51 Franklin Street, Suite 330 |
// | Boston, MA 02110-1301, USA. |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <jpm@mysql.com> |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('requirement.tpl.html');
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
if (@$_POST['cat'] == 'set_analysis') {
$res = Impact_Analysis::update($_POST['isr_id']);
$tpl->assign('set_analysis_result', $res);
}
$tpl->displayTemplate();
示例6: Template_Helper
<?php
/*
* This file is part of the Eventum (Issue Tracking System) package.
*
* @copyright (c) Eventum Team
* @license GNU General Public License, version 2 or later (GPL-2+)
*
* For the full copyright and license information,
* please see the COPYING and AUTHORS files
* that were distributed with this source code.
*/
require_once __DIR__ . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('manage/anonymous.tpl.html');
Auth::checkAuthentication();
@($prj_id = $_POST['prj_id'] ? $_POST['prj_id'] : $_GET['prj_id']);
$role_id = Auth::getCurrentRole();
if ($role_id < User::ROLE_MANAGER) {
Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR);
$tpl->displayTemplate();
exit;
}
if (@$_POST['cat'] == 'update') {
$res = Project::updateAnonymousPost($prj_id);
$tpl->assign('result', $res);
Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the information was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the information.'), Misc::MSG_ERROR)));
}
// load the form fields
$tpl->assign('project', Project::getDetails($prj_id));
$tpl->assign('cats', Category::getAssocList($prj_id));
示例7: Template_Helper
<?php
/*
* This file is part of the Eventum (Issue Tracking System) package.
*
* @copyright (c) Eventum Team
* @license GNU General Public License, version 2 or later (GPL-2+)
*
* For the full copyright and license information,
* please see the COPYING and AUTHORS files
* that were distributed with this source code.
*/
require_once __DIR__ . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('manage/time_tracking.tpl.html');
Auth::checkAuthentication();
$role_id = Auth::getCurrentRole();
if ($role_id < User::ROLE_MANAGER) {
Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR);
$tpl->displayTemplate();
exit;
}
$prj_id = isset($_POST['prj_id']) ? (int) $_POST['prj_id'] : (int) $_GET['prj_id'];
$cat = isset($_POST['cat']) ? (string) $_POST['cat'] : null;
$tpl->assign('project', Project::getDetails($prj_id));
if ($cat == 'new') {
$title = $_POST['title'];
$res = Time_Tracking::insertCategory($prj_id, $title);
Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the time tracking category was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the new time tracking category.'), Misc::MSG_INFO), -2 => array(ev_gettext('Please enter the title for this new time tracking category.'), Misc::MSG_ERROR)));
} elseif ($cat == 'update') {
$title = (string) $_POST['title'];
示例8: Template_Helper
<?php
/*
* This file is part of the Eventum (Issue Tracking System) package.
*
* @copyright (c) Eventum Team
* @license GNU General Public License, version 2 or later (GPL-2+)
*
* For the full copyright and license information,
* please see the COPYING and AUTHORS files
* that were distributed with this source code.
*/
require_once __DIR__ . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('manage/monitor.tpl.html');
Auth::checkAuthentication();
$role_id = Auth::getCurrentRole();
if ($role_id < User::ROLE_REPORTER) {
Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR);
$tpl->displayTemplate();
exit;
}
$tpl->assign('project_list', Project::getAll());
if (!empty($_POST['cat']) && $_POST['cat'] == 'update') {
$setup = array('diskcheck' => $_POST['diskcheck'], 'paths' => $_POST['paths'], 'ircbot' => $_POST['ircbot']);
$res = Setup::save(array('monitor' => $setup));
Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the setup information was saved successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext("ERROR: The system doesn't have the appropriate permissions to create the configuration file in the setup directory (%s). " . 'Please contact your local system administrator and ask for write privileges on the provided path.', APP_CONFIG_PATH), Misc::MSG_NOTE_BOX), -2 => array(ev_gettext("ERROR: The system doesn't have the appropriate permissions to update the configuration file in the setup directory (%s). " . 'Please contact your local system administrator and ask for write privileges on the provided filename.', APP_SETUP_FILE), Misc::MSG_NOTE_BOX)));
}
$tpl->assign(array('enable_disable', array('enabled' => ev_gettext('Enabled'), 'disabled' => ev_gettext('Disabled')), 'setup' => Setup::get()));
$tpl->displayTemplate();
示例9: Template_Helper
<?php
/*
* This file is part of the Eventum (Issue Tracking System) package.
*
* @copyright (c) Eventum Team
* @license GNU General Public License, version 2 or later (GPL-2+)
*
* For the full copyright and license information,
* please see the COPYING and AUTHORS files
* that were distributed with this source code.
*/
require_once __DIR__ . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('manage/severities.tpl.html');
Auth::checkAuthentication();
$role_id = Auth::getCurrentRole();
if ($role_id < User::ROLE_MANAGER) {
Misc::setMessage('Sorry, you are not allowed to access this page.', Misc::MSG_ERROR);
$tpl->displayTemplate();
exit;
}
@($prj_id = $_POST['prj_id'] ? $_POST['prj_id'] : $_GET['prj_id']);
$tpl->assign('project', Project::getDetails($prj_id));
if (@$_POST['cat'] == 'new') {
$res = Severity::insert($prj_id, $_POST['title'], $_POST['description'], $_POST['rank']);
Misc::mapMessages($res, array(1 => array('Thank you, the severity was added successfully.', Misc::MSG_INFO), -1 => array('An error occurred while trying to add the severity.', Misc::MSG_ERROR), -2 => array('Please enter the title for this new severity.', Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'update') {
$res = Severity::update($_POST['id'], $_POST['title'], $_POST['description'], $_POST['rank']);
Misc::mapMessages($res, array(1 => array('Thank you, the severity was added successfully.', Misc::MSG_INFO), -1 => array('An error occurred while trying to add the severity.', Misc::MSG_ERROR), -2 => array('Please enter the title for this new severity.', Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'delete') {
示例10: dirname
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to: |
// | |
// | Free Software Foundation, Inc. |
// | 51 Franklin Street, Suite 330 |
// | Boston, MA 02110-1301, USA. |
// +----------------------------------------------------------------------+
// | Authors: Bryan Alsdorf <bryan@mysql.com> |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('reports/workload_time_period.tpl.html');
Auth::checkAuthentication(APP_COOKIE);
$usr_id = Auth::getUserID();
if (!Access::canAccessReports(Auth::getUserID())) {
echo 'Invalid role';
exit;
}
$prj_id = Auth::getCurrentProject();
// get timezone of current user
$user_prefs = Prefs::get($usr_id);
if (@$_GET['type'] == 'email') {
$data = Report::getEmailWorkloadByTimePeriod(@$user_prefs['timezone']);
} else {
$data = Report::getWorkloadByTimePeriod(@$user_prefs['timezone']);
}
示例11: Template_Helper
<?php
/*
* This file is part of the Eventum (Issue Tracking System) package.
*
* @copyright (c) Eventum Team
* @license GNU General Public License, version 2 or later (GPL-2+)
*
* For the full copyright and license information,
* please see the COPYING and AUTHORS files
* that were distributed with this source code.
*/
require_once __DIR__ . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('manage/round_robin.tpl.html');
Auth::checkAuthentication();
$role_id = Auth::getCurrentRole();
if ($role_id < User::ROLE_MANAGER) {
Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR);
$tpl->displayTemplate();
exit;
}
if (@$_POST['cat'] == 'new') {
$res = Round_Robin::insert();
Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the round robin entry was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the round robin entry.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this round robin entry.'), Misc::MSG_ERROR), -3 => array(ev_gettext('Please enter the message for this round robin entry.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'update') {
$res = Round_Robin::update();
Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the round robin entry was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the round robin entry information.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this round robin entry.'), Misc::MSG_ERROR), -3 => array(ev_gettext('Please enter the message for this round robin entry.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'delete') {
Round_Robin::remove();
}
示例12: Template_Helper
<?php
/*
* This file is part of the Eventum (Issue Tracking System) package.
*
* @copyright (c) Eventum Team
* @license GNU General Public License, version 2 or later (GPL-2+)
*
* For the full copyright and license information,
* please see the COPYING and AUTHORS files
* that were distributed with this source code.
*/
require_once __DIR__ . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('reports/estimated_dev_time.tpl.html');
Auth::checkAuthentication();
if (!Access::canAccessReports(Auth::getUserID())) {
echo 'Invalid role';
exit;
}
// TODO: move this query to some class
$sql = 'SELECT
prc_id,
prc_title,
SUM(iss_dev_time) as dev_time
FROM
{{%issue}},
{{%project_category}},
{{%status}}
WHERE
iss_prc_id = prc_id AND
示例13: sendPasswordConfirmationEmail
/**
* Method used to send a confirmation email to the user that is associated
* to the email address.
*
* @param string $usr_id The user ID
* @return void
*/
public static function sendPasswordConfirmationEmail($usr_id)
{
$info = self::getDetails($usr_id);
// send confirmation email to user
$hash = md5($info['usr_full_name'] . $info['usr_email'] . Auth::privateKey());
$tpl = new Template_Helper();
$tpl->setTemplate('notifications/password_confirmation.tpl.text');
$tpl->assign(array('app_title' => Misc::getToolCaption(), 'user' => $info, 'hash' => $hash));
$text_message = $tpl->getTemplateContents();
$setup = Setup::load();
$mail = new Mail_Helper();
// need to make this message MIME based
$mail->setTextBody($text_message);
$mail->send($setup['smtp']['from'], $info['usr_email'], APP_SHORT_NAME . ': New Password - Confirmation Required');
}
示例14: dirname
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to: |
// | |
// | Free Software Foundation, Inc. |
// | 51 Franklin Street, Suite 330 |
// | Boston, MA 02110-1301, USA. |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <jpm@mysql.com> |
// | Authors: Elan Ruusamäe <glen@delfi.ee> |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('popup.tpl.html');
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$usr_id = Auth::getUserID();
$prj_id = Auth::getCurrentProject();
$iss_id = isset($_GET['iss_id']) ? (int) $_GET['iss_id'] : (isset($_POST['issue_id']) ? (int) $_POST['issue_id'] : null);
$cat = isset($_GET['cat']) ? (string) $_GET['cat'] : (isset($_POST['cat']) ? (string) $_POST['cat'] : null);
$id = isset($_GET['id']) ? (int) $_GET['id'] : null;
$status_id = isset($_GET['new_sta_id']) ? (int) $_GET['new_sta_id'] : null;
$isr_id = isset($_POST['isr_id']) ? (int) $_POST['isr_id'] : null;
$items = isset($_POST['item']) ? (array) $_POST['item'] : null;
if ($cat == 'delete_note') {
$res = Note::remove($id);
$tpl->assign('note_delete_result', $res);
} elseif ($cat == 'delete_time') {
$res = Time_Tracking::removeTimeEntry($id, $usr_id);
示例15: Template_Helper
<?php
/*
* This file is part of the Eventum (Issue Tracking System) package.
*
* @copyright (c) Eventum Team
* @license GNU General Public License, version 2 or later (GPL-2+)
*
* For the full copyright and license information,
* please see the COPYING and AUTHORS files
* that were distributed with this source code.
*/
require_once __DIR__ . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('manage/private_key.tpl.html');
Auth::checkAuthentication();
$role_id = Auth::getCurrentRole();
if ($role_id < User::ROLE_ADMINISTRATOR) {
Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR);
$tpl->displayTemplate();
exit;
}
$cat = isset($_POST['cat']) ? (string) $_POST['cat'] : null;
if ($cat == 'update') {
// regenerate key
try {
Auth::generatePrivateKey();
Misc::setMessage(ev_gettext('Thank you, the private key was regenerated.'));
} catch (Exception $e) {
Misc::setMessage(ev_gettext('Private key regeneration error. Check server error logs.'), Misc::MSG_ERROR);
}