本文整理汇总了PHP中canView函数的典型用法代码示例。如果您正苦于以下问题:PHP canView函数的具体用法?PHP canView怎么用?PHP canView使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了canView函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* The constructor
*
* Assigns the title, icon, module and help reference. If the user does not
* have permission to view the help module, then the context help icon is
* not displayed.
*/
public function __construct($title, $icon = '', $module = '')
{
global $AppUI;
$this->_AppUI = $AppUI;
global $w2Pconfig;
$this->_w2Pconfig = $w2Pconfig;
$this->title = $title;
$this->icon = $icon;
$this->module = $module;
$this->cells1 = array();
$this->cells2 = array();
$this->crumbs = array();
$this->showhelp = canView('help');
$this->count = 0;
}
示例2: die
No warranty whatsoever is given - use at your own risk. See index.php
*
*/
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
global $this_day, $prev_day, $next_day, $first_time, $last_time, $company_id, $event_filter, $event_filter_list, $AppUI;
// load the event types
$types = w2PgetSysVal('EventType');
$links = array();
$df = $AppUI->getPref('SHDATEFORMAT');
$perms =& $AppUI->acl();
$user_id = $AppUI->user_id;
$other_users = false;
$no_modify = false;
if (canView('admin')) {
$other_users = true;
if (($show_uid = w2PgetParam($_REQUEST, 'show_user_events', 0)) != 0) {
$user_id = $show_uid;
$no_modify = true;
$AppUI->setState('event_user_id', $user_id);
}
}
class CTask_ex extends CTask
{
public function getAllTasksForPeriod($start_date, $end_date, $company_id = 0, $user_id = null)
{
global $AppUI;
$q = new w2p_Database_Query();
// convert to default db time stamp
$db_start = $start_date->format(FMT_DATETIME_MYSQL);
示例3: executeFilter
//
// 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 the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
if (!canView('Events') || !empty($_REQUEST['execute']) && !canEdit('Events')) {
$view = "error";
return;
}
if (!empty($_REQUEST['execute'])) {
executeFilter($tempFilterName);
}
$countSql = 'SELECT count(E.Id) AS EventCount FROM Monitors AS M INNER JOIN Events AS E ON (M.Id = E.MonitorId) WHERE';
$eventsSql = 'SELECT E.Id,E.MonitorId,M.Name AS MonitorName,M.DefaultScale,E.Name,E.Width,E.Height,E.Cause,E.Notes,E.StartTime,E.Length,E.Frames,E.AlarmFrames,E.TotScore,E.AvgScore,E.MaxScore,E.Archived FROM Monitors AS M INNER JOIN Events AS E on (M.Id = E.MonitorId) WHERE';
if ($user['MonitorIds']) {
$user_monitor_ids = ' M.Id in (' . $user['MonitorIds'] . ')';
$countSql .= $user_monitor_ids;
$eventsSql .= $user_monitor_ids;
} else {
$countSql .= " 1";
$eventsSql .= " 1";
示例4: die
<?php
/* $Id$ $URL$ */
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
$perms =& $AppUI->acl();
if (!canView('tasks')) {
$AppUI->redirect('m=public&a=access_denied');
}
$proj = (int) w2PgetParam($_GET, 'project', 0);
$userFilter = w2PgetParam($_GET, 'userFilter', false);
$q = new w2p_Database_Query();
$q->addQuery('t.task_id, t.task_name');
$q->addTable('tasks', 't');
if ($userFilter) {
$q->addJoin('user_tasks', 'ut', 'ut.task_id = t.task_id');
$q->addWhere('ut.user_id = ' . (int) $AppUI->user_id);
}
if ($proj != 0) {
$q->addWhere('task_project = ' . (int) $proj);
}
$tasks = $q->loadList();
$q->clear();
?>
<script language="javascript" type="text/javascript">
function loadTasks() {
var tasks = new Array();
var sel = parent.document.forms['form'].new_task;
while (sel.options.length) {
示例5: validInteger
if (isset($_GET['pageOff' . $monitor['Id']])) {
/* If pageOffset is greater than we actually have,
* we need to adjust it */
$pageOffset = validInteger($_GET['pageOff' . $monitor['Id']]);
if ($pageOffset >= ceil($monitor['EventCount0'] / $numEvents)) {
$pageOffset = 0;
}
$offset = $pageOffset * $numEvents;
}
$eventsSql .= " offset " . $offset;
} else {
unset($eventsSql);
}
xml_tag_val("PAGEOFF", $pageOffset);
xml_tag_sec("EVENTS", 1);
if (canView('Events') && isset($eventsSql)) {
foreach (dbFetchAll(escapeSql($eventsSql)) as $event) {
xml_tag_sec("EVENT", 1);
xml_tag_val("ID", $event['Id']);
xml_tag_val("NAME", $event['Name']);
xml_tag_val("TIME", strftime(STRF_FMT_DATETIME_SHORTER, strtotime($event['StartTime'])));
xml_tag_val("DURATION", $event['Length']);
xml_tag_val("FRAMES", $event['Frames']);
xml_tag_val("FPS", $event['Length'] > 0 ? ceil($event['Frames'] / $event['Length']) : 0);
xml_tag_val("TOTSCORE", $event['TotScore']);
xml_tag_val("AVGSCORE", $event['AvgScore']);
xml_tag_val("MAXSCORE", $event['MaxScore']);
/* Grab the max frame-id from Frames table. If AlarmFrames = 0, don't try
* to grab any frames, and just signal the max frame index as index 0 */
$fridx = 1;
$alarmFrames = 1;
示例6: get_actual_end_date_pd
function get_actual_end_date_pd($task_id, $task)
{
global $AppUI;
$q = new w2p_Database_Query();
$mods = $AppUI->getActiveModules();
if (!empty($mods['history']) && canView('history')) {
$q->addQuery('MAX(history_date) as actual_end_date');
$q->addTable('history');
$q->addWhere('history_table=\'tasks\' AND history_item=' . $task_id);
} else {
$q->addQuery('MAX(task_log_date) AS actual_end_date');
$q->addTable('task_log');
$q->addWhere('task_log_task = ' . (int) $task_id);
}
$task_log_end_date = $q->loadResult();
$edate = $task_log_end_date;
$edate = $edate > $task->task_end_date || $task->task_percent_complete == 100 ? $edate : $task->task_end_date;
return $edate;
}
示例7: dbQuery
dbQuery("insert into Devices set Name=?, KeyString=?", array($_REQUEST['newDevice']['Name'], $_REQUEST['newDevice']['KeyString']));
}
$refreshParent = true;
$view = 'none';
}
} elseif ($action == "delete") {
if (isset($_REQUEST['markDids'])) {
foreach ($_REQUEST['markDids'] as $markDid) {
dbQuery("delete from Devices where Id=?", array($markDid));
$refreshParent = true;
}
}
}
}
// Group view actions
if (canView('Groups') && $action == "setgroup") {
if (!empty($_REQUEST['gid'])) {
setcookie("zmGroup", validInt($_REQUEST['gid']), time() + 3600 * 24 * 30 * 12 * 10);
} else {
setcookie("zmGroup", "", time() - 3600 * 24 * 2);
}
$refreshParent = true;
}
// Group edit actions
if (canEdit('Groups')) {
if ($action == "group") {
# Should probably verfy that each monitor id is a valid monitor, that we have access to. HOwever at the moment, you have to have System permissions to do this
$monitors = empty($_POST['newGroup']['MonitorIds']) ? NULL : implode(',', $_POST['newGroup']['MonitorIds']);
if (!empty($_POST['gid'])) {
dbQuery("UPDATE Groups SET Name=?, MonitorIds=? WHERE Id=?", array($_POST['newGroup']['Name'], $monitors, $_POST['gid']));
} else {
示例8: validHtmlStr
//
// 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 the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
if (!canView('Stream')) {
$view = "error";
return;
}
if (empty($_REQUEST['mode'])) {
if (canStream()) {
$mode = "stream";
} else {
$mode = "still";
}
} else {
$mode = validHtmlStr($_REQUEST['mode']);
}
$group = '';
$groupSql = '';
if (!empty($_REQUEST['group'])) {
示例9: w2PgetSysVal
$AppUI->setMsg('Event');
$AppUI->setMsg('invalidID', UI_MSG_ERROR, true);
$AppUI->redirect();
} else {
$AppUI->savePlace();
}
//check if the user has view permission over the project
if ($event->event_project && !$perms->checkModuleItem('projects', 'view', $event->event_project)) {
$AppUI->redirect('m=public&a=access_denied');
}
// load the event types
$types = w2PgetSysVal('EventType');
// load the event recurs types
$recurs = array('Never', 'Hourly', 'Daily', 'Weekly', 'Bi-Weekly', 'Every Month', 'Quarterly', 'Every 6 months', 'Every Year');
$assigned = $event->getAssigned();
if ($event->event_owner != $AppUI->user_id && !canView('admin')) {
$canEdit = false;
}
$df = $AppUI->getPref('SHDATEFORMAT');
$tf = $AppUI->getPref('TIMEFORMAT');
$start_date = $event->event_start_date ? new w2p_Utilities_Date($event->event_start_date) : new w2p_Utilities_Date();
$end_date = $event->event_end_date ? new w2p_Utilities_Date($event->event_end_date) : new w2p_Utilities_Date();
if ($event->event_project) {
$project = new CProject();
$event_project = $project->load($event->event_project)->project_name;
}
// setup the title block
$titleBlock = new CTitleBlock('View Event', 'myevo-appointments.png', $m, $m . '.' . $a);
if ($canEdit) {
$titleBlock->addCell();
$titleBlock->addCell('
示例10: die
<?php
/* $Id: projectdesigner_crumb.index.reports.php 1522 2010-12-08 05:08:07Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/reports/projectdesigner_crumb.index.reports.php $ */
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
global $titleBlock, $project_id;
$canView = canView('reports');
if ($canView) {
$titleBlock->addCrumb('?m=reports&project_id=' . $project_id, 'reports');
}
示例11: exportEvents
function exportEvents($eids, $exportDetail, $exportFrames, $exportImages, $exportVideo, $exportMisc, $exportFormat)
{
if (canView('Events') && !empty($eids)) {
$export_root = "zmExport";
$export_listFile = "zmFileList.txt";
$exportFileList = array();
$html_eventMaster = '';
if (is_array($eids)) {
foreach ($eids as $eid) {
$exportFileList = array_merge($exportFileList, exportFileList($eid, $exportDetail, $exportFrames, $exportImages, $exportVideo, $exportMisc));
}
} else {
$eid = $eids;
$exportFileList = exportFileList($eid, $exportDetail, $exportFrames, $exportImages, $exportVideo, $exportMisc);
}
// create an master image slider
if ($exportImages) {
if (!is_array($eids)) {
$eids = array($eids);
}
$monitorPath = 'events/';
$html_eventMaster = 'zmEventImagesMaster_' . date('Ymd_His') . '.html';
if (!($fp = fopen($monitorPath . "/" . $html_eventMaster, "w"))) {
Fatal("Can't open event images export file '{$html_eventMaster}'");
}
fwrite($fp, exportEventImagesMaster($eids));
fclose($fp);
$exportFileList[] = $monitorPath . "/" . $html_eventMaster;
}
$listFile = "temp/" . $export_listFile;
if (!($fp = fopen($listFile, "w"))) {
Fatal("Can't open event export list file '{$listFile}'");
}
foreach ($exportFileList as $exportFile) {
fwrite($fp, "{$exportFile}\n");
}
fclose($fp);
$archive = "";
if ($exportFormat == "tar") {
$archive = "temp/" . $export_root . ".tar.gz";
@unlink($archive);
$command = "tar --create --gzip --file={$archive} --files-from={$listFile}";
exec(escapeshellcmd($command), $output, $status);
if ($status) {
Error("Command '{$command}' returned with status {$status}");
if ($output[0]) {
Error("First line of output is '" . $output[0] . "'");
}
return false;
}
} elseif ($exportFormat == "zip") {
$archive = "temp/zm_export.zip";
$archive = "temp/" . $export_root . ".zip";
@unlink($archive);
$command = "cat " . escapeshellarg($listFile) . " | zip -q " . escapeshellarg($archive) . " -@";
//cat zmFileList.txt | zip -q zm_export.zip -@
//-bash: zip: command not found
exec($command, $output, $status);
if ($status) {
Error("Command '{$command}' returned with status {$status}");
if ($output[0]) {
Error("First line of output is '" . $output[0] . "'");
}
return false;
}
}
//clean up temporary files
if (!empty($html_eventMaster)) {
unlink($monitorPath . '/' . $html_eventMaster);
}
}
return $archive;
}
示例12: translate
//
// 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 the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
if (!canView('System')) {
$view = "error";
return;
}
$focusWindow = true;
xhtmlHeaders(__FILE__, translate('SystemLog'));
?>
<body>
<div id="page">
<div id="header">
<div id="headerButtons">
<input type="button" value="<?php
echo translate('More');
?>
" onclick="expandLog()"/>
<input type="button" value="<?php
示例13: getForums
public static function getForums(CAppUI $AppUI = null, $projectId)
{
global $AppUI;
if ($AppUI->isActiveModule('forums') && canView('forums')) {
$q = new w2p_Database_Query();
$q->addTable('forums');
$q->addQuery('forum_id, forum_project, forum_description, forum_owner, forum_name, forum_message_count,
DATE_FORMAT(forum_last_date, "%d-%b-%Y %H:%i" ) forum_last_date,
project_name, project_color_identifier, project_id');
$q->addJoin('projects', 'p', 'project_id = forum_project', 'inner');
$q->addWhere('forum_project = ' . (int) $projectId);
$q->addOrder('forum_project, forum_name');
return $q->loadHashList('forum_id');
}
}
示例14: elseif
}
}
} elseif ($action == "delete") {
foreach (getAffectedIds('markEid') as $markEid) {
deleteEvent($markEid);
$refreshParent = true;
}
if (!empty($_REQUEST['fid'])) {
dbQuery('DELETE FROM Filters WHERE Name=?', array($_REQUEST['fid']));
//$refreshParent = true;
}
}
}
}
// Monitor control actions, require a monitor id and control view permissions for that monitor
if (!empty($_REQUEST['mid']) && canView('Control', $_REQUEST['mid'])) {
require_once 'control_functions.php';
$mid = validInt($_REQUEST['mid']);
if ($action == "control") {
$monitor = dbFetchOne("select C.*,M.* from Monitors as M inner join Controls as C on (M.ControlId = C.Id) where M.Id = ?", NULL, array($mid));
$ctrlCommand = buildControlCommand($monitor);
sendControlCommand($monitor['Id'], $ctrlCommand);
} elseif ($action == "settings") {
$args = " -m " . escapeshellarg($mid);
$args .= " -B" . escapeshellarg($_REQUEST['newBrightness']);
$args .= " -C" . escapeshellarg($_REQUEST['newContrast']);
$args .= " -H" . escapeshellarg($_REQUEST['newHue']);
$args .= " -O" . escapeshellarg($_REQUEST['newColour']);
$zmuCommand = getZmuCommand($args);
$zmuOutput = exec($zmuCommand);
list($brightness, $contrast, $hue, $colour) = explode(' ', $zmuOutput);
示例15: die
<?php
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
$tab = $AppUI->processIntState('UserIdxTab', $_GET, 'tab', 0);
$perms =& $AppUI->acl();
if (!canView('users')) {
$AppUI->redirect(ACCESS_DENIED);
}
if (isset($_GET['stub'])) {
$AppUI->setState('UserIdxStub', w2PgetParam($_GET, 'stub', null));
$AppUI->setState('UserIdxWhere', '');
} elseif (isset($_POST['search_string'])) {
$AppUI->setState('UserIdxWhere', $_POST['search_string']);
$AppUI->setState('UserIdxStub', '');
}
$stub = $AppUI->getState('UserIdxStub');
$where = $AppUI->getState('UserIdxWhere');
$where = w2PformSafe($where, true);
if (isset($_GET['orderby'])) {
$AppUI->setState('UserIdxOrderby', w2PgetParam($_GET, 'orderby', null));
}
$orderby = $AppUI->getState('UserIdxOrderby') ? $AppUI->getState('UserIdxOrderby') : 'user_username';
$orderby = $tab == 3 || $orderby != 'date_time_in' && $orderby != 'user_ip' ? $orderby : 'user_username';
// Pull First Letters
$letters = CUser::getFirstLetters();
$letters = $letters . CContact::getFirstLetters($AppUI->user_id, true);
$a2z = '<a href="./index.php?m=users&stub=0">' . $AppUI->_('All') . '</a> ';
for ($c = 65; $c < 91; $c++) {
$cu = chr($c);