本文整理匯總了PHP中CAppUI::acl方法的典型用法代碼示例。如果您正苦於以下問題:PHP CAppUI::acl方法的具體用法?PHP CAppUI::acl怎麽用?PHP CAppUI::acl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CAppUI
的用法示例。
在下文中一共展示了CAppUI::acl方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: store
public function store(CAppUI $AppUI)
{
$perms = $AppUI->acl();
$stored = false;
$errorMsgArray = $this->check();
if (count($errorMsgArray) > 0) {
return $errorMsgArray;
}
/*
* TODO: I don't like the duplication on each of these two branches, but I
* don't have a good idea on how to fix it at the moment...
*/
if ($this->field_id && canEdit('system')) {
if ($msg = parent::store()) {
return $msg;
}
$stored = true;
}
if (0 == $this->field_id && canEdit('system')) {
if ($msg = parent::store()) {
return $msg;
}
$stored = true;
}
return $stored;
}
示例2: store
public function store(CAppUI $AppUI)
{
$perms = $AppUI->acl();
$stored = false;
$this->file_folder_id = (int) $this->file_folder_id;
$this->file_folder_parent = (int) $this->file_folder_parent;
$this->_error = $this->check();
if (count($this->_error)) {
return $this->_error;
}
/*
* TODO: I don't like the duplication on each of these two branches, but I
* don't have a good idea on how to fix it at the moment...
*/
if ($this->file_folder_id && $perms->checkModuleItem('files', 'edit')) {
if ($msg = parent::store()) {
return $msg;
}
$stored = true;
}
if (0 == $this->file_folder_id && $perms->checkModuleItem('files', 'add')) {
if ($msg = parent::store()) {
return $msg;
}
$stored = true;
}
return $stored;
}
示例3: remove
public function remove(CAppUI $AppUI, w2p_Utilities_Date $date)
{
$perms = $AppUI->acl();
$removed = false;
if ($this->holiday_id && $perms->checkModuleItem('holiday', 'edit', $this->holiday_id)) {
$holiday_start_date = new w2p_Utilities_Date($this->holiday_start_date);
$holiday_end_date = new w2p_Utilities_Date($this->holiday_end_date);
if ($holiday_start_date->equals($date->duplicate())) {
if ($holiday_end_date->equals($date->duplicate())) {
$removed = $this->delete($AppUI);
} else {
$holiday_start_date = new w2p_Utilities_Date($this->holiday_start_date);
$this->holiday_start_date = $holiday_start_date->getNextDay()->getDate();
$removed = $this->store($AppUI);
}
} elseif ($holiday_end_date->equals($date->duplicate())) {
$holiday_end_date = new w2p_Utilities_Date($this->holiday_end_date);
$this->holiday_end_date = $holiday_end_date->getPrevDay()->getDate();
$removed = $this->store($AppUI);
} elseif ($holiday_start_date->before($date->duplicate()) && $holiday_end_date->after($date->duplicate())) {
$holiday_end_date = $this->holiday_end_date;
$this->holiday_end_date = $date->getPrevDay()->getDate();
$removed = $this->store($AppUI);
$this->holiday_id = 0;
// create new record
$this->holiday_start_date = $date->getNextDay()->getDate();
$this->holiday_end_date = $holiday_end_date;
$removed = $this->store($AppUI);
}
}
return $removed;
}
示例4: remove
public function remove(CAppUI $AppUI = null)
{
global $AppUI;
$q = new w2p_Database_Query();
$q->dropTable('history');
$q->exec();
$perms = $AppUI->acl();
return $perms->unregisterModule('history');
}
示例5: delete
public function delete(CAppUI $AppUI)
{
$perms = $AppUI->acl();
$this->_error = array();
if ($perms->checkModuleItem('resources', 'delete', $this->resource_id)) {
if ($msg = parent::delete()) {
return $msg;
}
return true;
}
return false;
}
示例6: store
public function store(CAppUI $AppUI = null)
{
global $AppUI;
global $helpdesk_available;
$perms = $AppUI->acl();
$errorMsgArray = $this->check();
if (count($errorMsgArray) > 0) {
return $errorMsgArray;
}
if ($helpdesk_available && $this->file_helpdesk_item != 0) {
$this->addHelpDeskTaskLog();
}
if ($msg = parent::store()) {
return false;
}
addHistory('files', $this->file_id, 'store', $this->file_name, $this->file_id);
return true;
}
示例7: delete
public function delete(CAppUI $AppUI = null)
{
global $AppUI;
$perms = $AppUI->acl();
$result = false;
$this->_error = array();
if ($perms->checkModuleItem('forums', 'delete', $this->project_id)) {
$q = $this->_query;
$q->setDelete('forum_visits');
$q->addWhere('visit_message = ' . (int) $this->message_id);
$q->exec();
// No error if this fails, it is not important.
$q->clear();
$q->addTable('forum_messages');
$q->addQuery('message_forum');
$q->addWhere('message_id = ' . (int) $this->message_id);
$forumId = $q->loadResult();
$q->clear();
$q->setDelete('forum_messages');
$q->addWhere('message_id = ' . (int) $this->message_id);
if (!$q->exec()) {
$result = db_error();
} else {
$result = null;
}
$q->clear();
$q->addTable('forum_messages');
$q->addQuery('COUNT(message_id)');
$q->addWhere('message_forum = ' . (int) $forumId);
$messageCount = $q->loadResult();
$q->clear();
$q->addTable('forums');
$q->addUpdate('forum_message_count', $messageCount);
$q->addWhere('forum_id = ' . (int) $forumId);
$q->exec();
$result = true;
}
return $result;
}
示例8: store
public function store(CAppUI $AppUI)
{
global $AppUI;
$perms = $AppUI->acl();
return true;
}
示例9: store
public function store(CAppUI $AppUI)
{
$perms = $AppUI->acl();
$stored = false;
$errorMsgArray = $this->check();
if (count($errorMsgArray) > 0) {
return $errorMsgArray;
}
$this->company_id = (int) $this->company_id;
/*
* TODO: I don't like the duplication on each of these two branches, but I
* don't have a good idea on how to fix it at the moment...
*/
if ($this->company_id && $perms->checkModuleItem('companies', 'edit', $this->company_id)) {
if ($msg = parent::store()) {
return $msg;
}
addHistory('companies', $this->company_id, 'update', $this->company_name, $this->company_id);
$stored = true;
}
if (0 == $this->company_id && $perms->checkModuleItem('companies', 'add')) {
if ($msg = parent::store()) {
return $msg;
}
addHistory('companies', $this->company_id, 'add', $this->company_name, $this->company_id);
$stored = true;
}
if ($stored) {
$custom_fields = new CustomFields('companies', 'addedit', $this->company_id, 'edit');
$custom_fields->bind($_POST);
$sql = $custom_fields->store($this->company_id);
// Store Custom Fields
}
return $stored;
}
示例10: store
public function store(CAppUI $AppUI)
{
$perms = $AppUI->acl();
$stored = false;
$errorMsgArray = $this->check();
if (count($errorMsgArray) > 0) {
return $errorMsgArray;
}
if ($this->link_id && $perms->checkModuleItem('links', 'edit', $this->link_id)) {
$q = new DBQuery();
$this->link_date = $q->dbfnNow();
if ($msg = parent::store()) {
return $msg;
}
addHistory('links', $this->link_id, 'update', $this->link_name, $this->link_id);
$stored = true;
}
if (0 == $this->link_id && $perms->checkModuleItem('links', 'add')) {
$q = new DBQuery();
$this->link_date = $q->dbfnNow();
if ($msg = parent::store()) {
return $msg;
}
addHistory('links', $this->link_id, 'add', $this->link_name, $this->link_id);
$stored = true;
}
return $stored;
}
示例11: deleteFile
public function deleteFile(CAppUI $AppUI = null)
{
global $AppUI;
$perms = $AppUI->acl();
if ($perms->checkModuleItem('files', 'delete', $this->file_id)) {
return @unlink(W2P_BASE_DIR . '/files/' . $this->file_project . '/' . $this->file_real_filename);
}
}
示例12: getDepartments
public static function getDepartments(CAppUI $AppUI, $companyId)
{
$perms = $AppUI->acl();
if ($AppUI->isActiveModule('departments') && canView('departments')) {
$q = new w2p_Database_Query();
$q->addTable('departments');
$q->addQuery('departments.*, COUNT(contact_department) dept_users');
$q->addJoin('contacts', 'c', 'c.contact_department = dept_id');
$q->addWhere('dept_company = ' . (int) $companyId);
$q->addGroup('dept_id');
$q->addOrder('dept_parent, dept_name');
$department = new CDepartment();
$department->setAllowedSQL($AppUI->user_id, $q);
return $q->loadList();
}
}
示例13: updateTaskSummary
/**
* Updates the variable information on the task.
*
* @param int $task_log_task that task id of task this task log is for
*
* @return void
*
* @access private
*/
private function updateTaskSummary(CAppUI $AppUI, $task_id)
{
$perms = $AppUI->acl();
$q = $this->_query;
if ($perms->checkModuleItem('tasks', 'edit', $task_id)) {
if ($this->task_log_percent_complete < 100) {
$q->addQuery('task_log_percent_complete, task_log_date, task_log_task_end_date');
$q->addTable('task_log');
$q->addWhere('task_log_task = ' . (int) $task_id);
$q->addOrder('task_log_date DESC, task_log_id DESC');
$q->setLimit(1);
$results = $q->loadHash();
$q->clear();
$percentComplete = $results['task_log_percent_complete'];
/*
* TODO: In theory, we shouldn't just use the task_log_task_end_date,
* because if we're after that date and someone is still adding
* logs to a task, obviously the task isn't complete. We may want
* to check to see if task_log_date > task_log_task_end_date and
* use the later one as the end date.. not sure yet.
*/
$taskEndDate = $results['task_log_task_end_date'];
} else {
$percentComplete = 100;
$taskEndDate = $this->task_log_date;
}
$task = new CTask();
$task->load($task_id);
$task->task_percent_complete = $percentComplete;
$task->task_end_date = $taskEndDate;
$msg = $task->store($AppUI);
if (is_array($msg)) {
$AppUI->setMsg($msg, UI_MSG_ERROR, true);
}
$task->pushDependencies($task_id, $task->task_end_date);
}
$q->addQuery('SUM(task_log_hours)');
$q->addTable('task_log');
$q->addWhere('task_log_task = ' . (int) $task_log_task);
$totalHours = $q->loadResult();
CTask::updateHoursWorked($task_id, $totalHours);
}
示例14: delete
public function delete(CAppUI $AppUI = null)
{
global $AppUI;
$perms = $AppUI->acl();
$this->_error = array();
if ($perms->checkModuleItem('departments', 'delete', $this->dept_id)) {
$q = new w2p_Database_Query();
$q->addTable('departments', 'dep');
$q->addQuery('dep.dept_id');
$q->addWhere('dep.dept_parent = ' . (int) $this->dept_id);
$rows = $q->loadList();
$q->clear();
if (count($rows)) {
//return 'deptWithSub';
return false;
}
$q->addTable('project_departments', 'pd');
$q->addQuery('pd.project_id');
$q->addWhere('pd.department_id = ' . (int) $this->dept_id);
$rows = $q->loadList();
$q->clear();
if (count($rows)) {
//return 'deptWithProject';
return false;
}
if ($msg = parent::delete()) {
return $msg;
}
return true;
}
return false;
}
示例15: updateStatus
public static function updateStatus(CAppUI $AppUI = null, $projectId, $statusId)
{
global $AppUI;
trigger_error("CProject::updateStatus has been deprecated in v2.3 and will be removed by v4.0.", E_USER_NOTICE);
$perms = $AppUI->acl();
if ($perms->checkModuleItem('projects', 'edit', $projectId) && $projectId > 0 && $statusId >= 0) {
$q = new w2p_Database_Query();
$q->addTable('projects');
$q->addUpdate('project_status', $statusId);
$q->addWhere('project_id = ' . (int) $projectId);
$q->exec();
}
}