当前位置: 首页>>代码示例>>PHP>>正文


PHP Report::canAdd方法代码示例

本文整理汇总了PHP中Report::canAdd方法的典型用法代码示例。如果您正苦于以下问题:PHP Report::canAdd方法的具体用法?PHP Report::canAdd怎么用?PHP Report::canAdd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Report的用法示例。


在下文中一共展示了Report::canAdd方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: count

<?php

$genid = gen_id();
$selectedPage = user_config_option('custom_report_tab');
$customReports = Reports::getAllReportsByObjectType();
$report = new Report();
$can_add_reports = $report->canAdd(logged_user(), active_context());
$reportPages = array();
$object_types = ObjectTypes::getAvailableObjectTypes();
foreach ($object_types as $ot) {
    $reportPages[$ot->getId()] = array("name" => $ot->getName(), "display_name" => lang($ot->getName()));
}
$ignored = null;
Hook::fire('modify_report_pages', $ignored, $reportPages);
// To add, edit or remove report pages
$default_reports = array('task' => array('task time report' => array('url' => get_url('reporting', 'total_task_times_p'), 'name' => lang('task time report'), 'description' => lang('task time report description'))));
Hook::fire('modify_default_reports', $ignored, $default_reports);
// To add, edit or remove default reports
require_javascript("og/ReportingFunctions.js");
?>

<div style="padding:7px">
<table width=100% id="reportingMenu">
<tr>
	<td style="height:2px;width:140px"></td><td width=12></td><td style="line-height:2px;">&nbsp;</td><td width=12></td>
</tr>
<tr>
<td height=12></td>
<td rowspan=<?php 
echo count($reportPages) + 2;
?>
开发者ID:rorteg,项目名称:fengoffice,代码行数:31,代码来源:index.php

示例2: array

 function add_custom_report()
 {
     if (logged_user()->isGuest()) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     tpl_assign('url', get_url('reporting', 'add_custom_report'));
     $report_data = array_var($_POST, 'report');
     if (is_array($report_data)) {
         tpl_assign('report_data', $report_data);
         $conditions = array_var($_POST, 'conditions');
         if (!is_array($conditions)) {
             $conditions = array();
         }
         tpl_assign('conditions', $conditions);
         $columns = array_var($_POST, 'columns');
         if (is_array($columns) && count($columns) > 0) {
             tpl_assign('columns', $columns);
             $newReport = new Report();
             if (!$newReport->canAdd(logged_user())) {
                 flash_error(lang('no access permissions'));
                 ajx_current("empty");
                 return;
             }
             // if
             $newReport->setName($report_data['name']);
             $newReport->setDescription($report_data['description']);
             $newReport->setObjectType($report_data['object_type']);
             $newReport->setOrderBy($report_data['order_by']);
             $newReport->setIsOrderByAsc($report_data['order_by_asc'] == 'asc');
             try {
                 DB::beginWork();
                 $newReport->save();
                 $allowed_columns = $this->get_allowed_columns($report_data['object_type'], true);
                 foreach ($conditions as $condition) {
                     if ($condition['deleted'] == "1") {
                         continue;
                     }
                     foreach ($allowed_columns as $ac) {
                         if ($condition['field_name'] == $ac['id']) {
                             $newCondition = new ReportCondition();
                             $newCondition->setReportId($newReport->getId());
                             $newCondition->setCustomPropertyId($condition['custom_property_id']);
                             $newCondition->setFieldName($condition['field_name']);
                             $newCondition->setCondition($condition['condition']);
                             $condValue = array_key_exists('value', $condition) ? $condition['value'] : '';
                             if ($condition['field_type'] == 'boolean') {
                                 $newCondition->setValue(array_key_exists('value', $condition));
                             } else {
                                 if ($condition['field_type'] == 'date') {
                                     if ($condValue != '') {
                                         $dtFromWidget = DateTimeValueLib::dateFromFormatAndString(user_config_option('date_format'), $condValue);
                                         $newCondition->setValue(date("m/d/Y", $dtFromWidget->getTimestamp()));
                                     }
                                 } else {
                                     $newCondition->setValue($condValue);
                                 }
                             }
                             $newCondition->setIsParametrizable(isset($condition['is_parametrizable']));
                             $newCondition->save();
                         }
                     }
                 }
                 asort($columns);
                 //sort the array by column order
                 foreach ($columns as $column => $order) {
                     if ($order > 0) {
                         $newColumn = new ReportColumn();
                         $newColumn->setReportId($newReport->getId());
                         if (is_numeric($column)) {
                             $newColumn->setCustomPropertyId($column);
                         } else {
                             $newColumn->setFieldName($column);
                         }
                         $newColumn->save();
                     }
                 }
                 DB::commit();
                 flash_success(lang('custom report created'));
                 ajx_current('back');
             } catch (Exception $e) {
                 DB::rollback();
                 flash_error($e->getMessage());
                 ajx_current("empty");
             }
         }
     }
     $selected_type = array_var($_GET, 'type', '');
     $types = array(array("", lang("select one")), array("Companies", lang("companies")), array("Contacts", lang("contacts")), array("MailContents", lang("email type")), array("ProjectEvents", lang("events")), array("ProjectFiles", lang("file")), array("ProjectMilestones", lang("milestone")), array("ProjectMessages", lang("message")), array("ProjectTasks", lang("task")), array("Users", lang("user")), array("ProjectWebpages", lang("webpage")), array("Projects", lang("workspace")));
     if ($selected_type != '') {
         tpl_assign('allowed_columns', $this->get_allowed_columns($selected_type));
     }
     tpl_assign('object_types', $types);
     tpl_assign('selected_type', $selected_type);
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:96,代码来源:ReportingController.class.php

示例3: count

<?php

$genid = gen_id();
$selectedPage = user_config_option('custom_report_tab', 'tasks');
$customReports = Reports::getAllReportsByObjectType();
$manageReports = can_manage_reports(logged_user());
$report = new Report();
$can_add_reports = $report->canAdd(logged_user());
$reportPages = array("contacts" => array("type" => "Contacts"), "companies" => array("type" => "Companies"), "workspaces" => array("type" => "Projects"), "messages" => array("type" => "ProjectMessages"), "documents" => array("type" => "ProjectFiles"), "emails" => array("type" => "MailContents"), "tasks" => array("type" => "ProjectTasks"), "milestones" => array("type" => "ProjectMilestones"), "events" => array("type" => "ProjectEvents"), "weblinks" => array("type" => "ProjectWebpages"));
if (logged_user()->isAdministrator()) {
    $reportPages["users"] = array("type" => "Users");
}
require_javascript("og/ReportingFunctions.js");
?>

<div style="padding:7px">
<table width=100% id="reportingMenu">
<tr>
	<td style="height:2px;width:140px"></td><td width=12></td><td style="line-height:2px;">&nbsp;</td><td width=12></td>
</tr>
<tr>
<td height=12></td>
<td rowspan=<?php 
echo count($reportPages) + 2;
?>
 colspan=2 style="background-color:white">

<div style="padding:10px">
<?php 
// MAIN PAGES
$show_help_option = user_config_option('show_context_help');
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:31,代码来源:index.php

示例4: array

 function add_custom_report()
 {
     if (logged_user()->isGuest()) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     tpl_assign('url', get_url('reporting', 'add_custom_report'));
     $report_data = array_var($_POST, 'report');
     if (is_array($report_data)) {
         tpl_assign('report_data', $report_data);
         $conditions = array_var($_POST, 'conditions');
         if (!is_array($conditions)) {
             $conditions = array();
         }
         tpl_assign('conditions', $conditions);
         $columns = array_var($_POST, 'columns');
         if (is_array($columns) && count($columns) > 0) {
             tpl_assign('columns', $columns);
             $newReport = new Report();
             $member_ids = json_decode(array_var($_POST, 'members'));
             if (!is_array($member_ids) || count($member_ids) == 0) {
                 flash_error(lang('must choose at least one member'));
                 ajx_current("empty");
                 return;
             }
             $members = Members::findAll(array("conditions" => array("`id` IN(?)", $member_ids)));
             if (!$newReport->canAdd(logged_user(), $members)) {
                 flash_error(lang('no access permissions'));
                 ajx_current("empty");
                 return;
             }
             // if
             $newReport->setObjectName($report_data['name']);
             $newReport->setDescription($report_data['description']);
             $newReport->setReportObjectTypeId($report_data['report_object_type_id']);
             $newReport->setOrderBy($report_data['order_by']);
             $newReport->setIsOrderByAsc($report_data['order_by_asc'] == 'asc');
             try {
                 DB::beginWork();
                 $newReport->save();
                 $allowed_columns = $this->get_allowed_columns($report_data['report_object_type_id'], true);
                 foreach ($conditions as $condition) {
                     if ($condition['deleted'] == "1") {
                         continue;
                     }
                     foreach ($allowed_columns as $ac) {
                         if ($condition['field_name'] == $ac['id']) {
                             $newCondition = new ReportCondition();
                             $newCondition->setReportId($newReport->getId());
                             $newCondition->setCustomPropertyId($condition['custom_property_id']);
                             $newCondition->setFieldName($condition['field_name']);
                             $newCondition->setCondition($condition['condition']);
                             $condValue = array_key_exists('value', $condition) ? $condition['value'] : '';
                             if ($condition['field_type'] == 'boolean') {
                                 $newCondition->setValue(array_key_exists('value', $condition));
                             } else {
                                 if ($condition['field_type'] == 'date') {
                                     if ($condValue != '') {
                                         $dtFromWidget = DateTimeValueLib::dateFromFormatAndString(user_config_option('date_format'), $condValue);
                                         $newCondition->setValue(date("m/d/Y", $dtFromWidget->getTimestamp()));
                                     }
                                 } else {
                                     $newCondition->setValue($condValue);
                                 }
                             }
                             $newCondition->setIsParametrizable(isset($condition['is_parametrizable']));
                             $newCondition->save();
                         }
                     }
                 }
                 asort($columns);
                 //sort the array by column order
                 foreach ($columns as $column => $order) {
                     if ($order > 0) {
                         $newColumn = new ReportColumn();
                         $newColumn->setReportId($newReport->getId());
                         if (is_numeric($column)) {
                             $newColumn->setCustomPropertyId($column);
                         } else {
                             $newColumn->setFieldName($column);
                         }
                         $newColumn->save();
                     }
                 }
                 $object_controller = new ObjectController();
                 $object_controller->add_to_members($newReport, $member_ids);
                 DB::commit();
                 flash_success(lang('custom report created'));
                 ajx_current('back');
             } catch (Exception $e) {
                 DB::rollback();
                 flash_error($e->getMessage());
                 ajx_current("empty");
             }
         }
     }
     $selected_type = array_var($_GET, 'type', '');
     $types = array(array("", lang("select one")));
     $object_types = ObjectTypes::getAvailableObjectTypes();
//.........这里部分代码省略.........
开发者ID:rorteg,项目名称:fengoffice,代码行数:101,代码来源:ReportingController.class.php

示例5: foreach

 function add_custom_report()
 {
     if (logged_user()->isGuest()) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     tpl_assign('url', get_url('reporting', 'add_custom_report'));
     $report_data = array_var($_POST, 'report');
     if (is_array($report_data)) {
         foreach ($report_data as $k => &$v) {
             $v = remove_scripts($v);
         }
         tpl_assign('report_data', $report_data);
         $conditions = array_var($_POST, 'conditions');
         if (!is_array($conditions)) {
             $conditions = array();
         }
         tpl_assign('conditions', $conditions);
         $columns = array_var($_POST, 'columns');
         if (is_array($columns) && count($columns) > 0) {
             tpl_assign('columns', $columns);
             $newReport = new Report();
             $member_ids = json_decode(array_var($_POST, 'members'));
             $notAllowedMember = '';
             if (!logged_user()->isManager() && !logged_user()->isAdminGroup() && !$newReport->canAdd(logged_user(), active_context(), $notAllowedMember)) {
                 if (str_starts_with($notAllowedMember, '-- req dim --')) {
                     flash_error(lang('must choose at least one member of', str_replace_first('-- req dim --', '', $notAllowedMember, $in)));
                 } else {
                     trim($notAllowedMember) == "" ? flash_error(lang('you must select where to keep', lang('the report'))) : flash_error(lang('no context permissions to add', lang("report"), $notAllowedMember));
                 }
                 ajx_current("empty");
                 return;
             }
             $newReport->setObjectName($report_data['name']);
             $newReport->setDescription($report_data['description']);
             $newReport->setReportObjectTypeId($report_data['report_object_type_id']);
             $newReport->setOrderBy($report_data['order_by']);
             $newReport->setIsOrderByAsc($report_data['order_by_asc'] == 'asc');
             $newReport->setIgnoreContext(array_var($report_data, 'ignore_context') == 'checked');
             try {
                 DB::beginWork();
                 $newReport->save();
                 $allowed_columns = $this->get_allowed_columns($report_data['report_object_type_id'], true);
                 foreach ($conditions as $condition) {
                     if ($condition['deleted'] == "1") {
                         continue;
                     }
                     foreach ($allowed_columns as $ac) {
                         if ($condition['field_name'] == $ac['id']) {
                             $newCondition = new ReportCondition();
                             $newCondition->setReportId($newReport->getId());
                             $newCondition->setCustomPropertyId($condition['custom_property_id']);
                             $newCondition->setFieldName($condition['field_name']);
                             $newCondition->setCondition($condition['condition']);
                             $condValue = array_key_exists('value', $condition) ? $condition['value'] : '';
                             if ($condition['field_type'] == 'boolean') {
                                 $newCondition->setValue(array_key_exists('value', $condition) ? '1' : '0');
                             } else {
                                 if ($condition['field_type'] == 'date') {
                                     if ($condValue != '') {
                                         $dtFromWidget = DateTimeValueLib::dateFromFormatAndString(user_config_option('date_format'), $condValue);
                                         $newCondition->setValue(date("m/d/Y", $dtFromWidget->getTimestamp()));
                                     }
                                 } else {
                                     $newCondition->setValue($condValue);
                                 }
                             }
                             $newCondition->setIsParametrizable(isset($condition['is_parametrizable']));
                             $newCondition->save();
                         }
                     }
                 }
                 asort($columns);
                 //sort the array by column order
                 foreach ($columns as $column => $order) {
                     if ($order > 0) {
                         $newColumn = new ReportColumn();
                         $newColumn->setReportId($newReport->getId());
                         if (is_numeric($column)) {
                             $newColumn->setCustomPropertyId($column);
                         } else {
                             $newColumn->setFieldName($column);
                         }
                         $newColumn->save();
                     }
                 }
                 $no_need_to_add_to_members = count($member_ids) == 0 && (logged_user()->isManager() || logged_user()->isAdminGroup());
                 if (!$no_need_to_add_to_members) {
                     $object_controller = new ObjectController();
                     $object_controller->add_to_members($newReport, $member_ids);
                 } else {
                     $newReport->addToSharingTable();
                 }
                 DB::commit();
                 flash_success(lang('custom report created'));
                 ajx_current('back');
             } catch (Exception $e) {
                 DB::rollback();
                 flash_error($e->getMessage());
//.........这里部分代码省略.........
开发者ID:abhinay100,项目名称:feng_app,代码行数:101,代码来源:ReportingController.class.php


注:本文中的Report::canAdd方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。