/** * Returns data on when support emails are sent/received. * * @param string $timezone Timezone to display time in in addition to GMT * @param boolean $graph If the data should be formatted for use in a graph. Default false * @return array An array of data. */ public static function getEmailWorkloadByTimePeriod($timezone, $graph = false) { // get total counts $stmt = 'SELECT hour(sup_date) AS time_period, count(*) as events FROM {{%support_email}} GROUP BY time_period'; try { $total = DB_Helper::getInstance()->fetchAssoc($stmt); } catch (DbException $e) { return array(); } // get all developer email addresses $users = User::getActiveAssocList(Auth::getCurrentProject(), User::getRoleID('customer')); $emails = array(); foreach ($users as $usr_id => $usr_full_name) { $emails[] = User::getFromHeader($usr_id); } // get number of support emails from developers $list = DB_Helper::buildList($emails); $stmt = "SELECT\n hour(sup_date) AS time_period,\n count(*) as events\n FROM\n {{%support_email}}\n WHERE\n sup_from IN({$list})\n GROUP BY\n time_period"; try { $dev_stats = DB_Helper::getInstance()->fetchAssoc($stmt, $emails); } catch (DbException $e) { return array(); } // get total number of developer and customer events and build cust_stats array $dev_count = 0; $cust_count = 0; $cust_stats = array(); for ($i = 0; $i < 24; $i++) { if (empty($dev_stats[$i])) { $dev_stats[$i] = 0; } $cust_stats[$i] = @$total[$i] - @$dev_stats[$i]; $cust_count += @$total[$i] - @$dev_stats[$i]; $dev_count += @$dev_stats[$i]; } $data = array(); $sort_values = array(); for ($i = 0; $i < 24; $i++) { // convert to the users time zone $dt = Date_Helper::getDateTime(mktime($i, 0, 0), 'GMT'); $gmt_time = $dt->format('H:i'); $dt->setTimeZone(new DateTimeZone($timezone)); $hour = $dt->format('H'); $user_time = $dt->format('H:i'); if ($graph) { $data['developer'][$hour] = ''; $data['customer'][$hour] = ''; } else { $data[$i]['display_time_gmt'] = $gmt_time; $data[$i]['display_time_user'] = $user_time; } // use later to find highest value $sort_values['developer'][$i] = $dev_stats[$i]; $sort_values['customer'][$i] = $cust_stats[$i]; if ($graph) { if ($dev_count == 0) { $data['developer'][$hour] = 0; } else { $data['developer'][$hour] = $dev_stats[$i] / $dev_count * 100; } if ($cust_count == 0) { $data['customer'][$hour] = 0; } else { $data['customer'][$hour] = $cust_stats[$i] / $cust_count * 100; } } else { $data[$i]['developer']['count'] = $dev_stats[$i]; if ($dev_count == 0) { $data[$i]['developer']['percentage'] = 0; } else { $data[$i]['developer']['percentage'] = $dev_stats[$i] / $dev_count * 100; } $data[$i]['customer']['count'] = $cust_stats[$i]; if ($cust_count == 0) { $data[$i]['customer']['percentage'] = 0; } else { $data[$i]['customer']['percentage'] = $cust_stats[$i] / $cust_count * 100; } } } if (!$graph) { // get the highest action times foreach ($sort_values as $performer => $values) { arsort($values); reset($values); $data[key($values)][$performer]['rank'] = 1; } } return $data; }
function getList($fld_id) { return User::getActiveAssocList(Auth::getCurrentProject(), User::getRoleID("Standard User")); }
* that were distributed with this source code. */ require_once __DIR__ . '/../../init.php'; $tpl = new Template_Helper(); $tpl->setTemplate('manage/products.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; } if (@$_POST['cat'] == 'new') { $res = Product::insert($_POST['title'], $_POST['version_howto'], $_POST['rank'], @$_POST['removed'], @$_POST['email']); Misc::mapMessages($res, array(1 => array('Thank you, the product was added successfully.', Misc::MSG_INFO), -1 => array('An error occurred while trying to add the product.', Misc::MSG_ERROR))); } elseif (@$_POST['cat'] == 'update') { $res = Product::update($_POST['id'], $_POST['title'], $_POST['version_howto'], $_POST['rank'], @$_POST['removed'], @$_POST['email']); Misc::mapMessages($res, array(1 => array('Thank you, the product was updated successfully.', Misc::MSG_INFO), -1 => array('An error occurred while trying to update the product.', Misc::MSG_ERROR))); } elseif (@$_POST['cat'] == 'delete') { Product::remove($_POST['items']); } if (@$_GET['cat'] == 'edit') { $info = Product::getDetails($_GET['id']); $tpl->assign('info', $info); $user_options = User::getActiveAssocList(Auth::getCurrentProject(), User::ROLE_CUSTOMER, false, $_GET['id']); } else { $user_options = User::getActiveAssocList(Auth::getCurrentProject(), User::ROLE_CUSTOMER, true); } $tpl->assign('list', Product::getList()); $tpl->assign('project_list', Project::getAll()); $tpl->displayTemplate();
*/ 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(); } if (@$_GET['cat'] == 'edit') { $info = Round_Robin::getDetails($_GET['id']); $tpl->assign('info', $info); $_REQUEST['prj_id'] = $info['prr_prj_id']; } $tpl->assign('list', Round_Robin::getList()); if (!empty($_REQUEST['prj_id'])) { $tpl->assign('user_options', User::getActiveAssocList($_REQUEST['prj_id'], User::ROLE_CUSTOMER)); } $tpl->assign('project_list', Project::getAll()); $tpl->displayTemplate();
include_once APP_INC_PATH . "class.workflow.php"; include_once APP_INC_PATH . "db_access.php"; $tpl = new Template_API(); $tpl->setTemplate("manage/index.tpl.html"); Auth::checkAuthentication(APP_COOKIE); $tpl->assign("type", "projects"); $role_id = Auth::getCurrentRole(); if ($role_id == User::getRoleID('administrator') || $role_id == User::getRoleID('manager')) { if ($role_id == User::getRoleID('administrator')) { $tpl->assign("show_setup_links", true); } if (@$HTTP_POST_VARS["cat"] == "new") { $tpl->assign("result", Project::insert()); } elseif (@$HTTP_POST_VARS["cat"] == "update") { $tpl->assign("result", Project::update()); } elseif (@$HTTP_POST_VARS["cat"] == "delete") { Project::remove(); } $tpl->assign("active_projects", Project::getAssocList(Auth::getUserID(), true)); if (@$HTTP_GET_VARS["cat"] == "edit") { $tpl->assign("info", Project::getDetails($HTTP_GET_VARS["id"])); } $tpl->assign("list", Project::getList()); $tpl->assign("user_options", User::getActiveAssocList(false, NULL, false, false, true)); $tpl->assign("status_options", Status::getAssocList()); $tpl->assign("customer_backends", Customer::getBackendList()); $tpl->assign("workflow_backends", Workflow::getBackendList()); } else { $tpl->assign("show_not_allowed_msg", true); } $tpl->displayTemplate();
if ($role_id == User::getRoleID('administrator') || $role_id == User::getRoleID('manager')) { if ($role_id == User::getRoleID('administrator')) { $tpl->assign("show_setup_links", true); } if (@$HTTP_POST_VARS["cat"] == "new") { $tpl->assign("result", Customer::insertAccountManager()); } elseif (@$HTTP_POST_VARS["cat"] == "update") { $tpl->assign("result", Customer::updateAccountManager()); } elseif (@$HTTP_POST_VARS["cat"] == "delete") { Customer::removeAccountManager(); } elseif (!empty($HTTP_GET_VARS['prj_id'])) { $tpl->assign("info", array('cam_prj_id' => $HTTP_GET_VARS['prj_id'])); $tpl->assign('customers', Customer::getAssocList($HTTP_GET_VARS['prj_id'])); } if (@$HTTP_GET_VARS["cat"] == "edit") { $info = Customer::getAccountManagerDetails($HTTP_GET_VARS["id"]); if (!empty($HTTP_GET_VARS['prj_id'])) { $info['cam_prj_id'] = $HTTP_GET_VARS['prj_id']; } $tpl->assign('customers', Customer::getAssocList($info['cam_prj_id'])); $tpl->assign("info", $info); } $tpl->assign("list", Customer::getAccountManagerList()); if (!empty($_REQUEST['prj_id'])) { $tpl->assign("user_options", User::getActiveAssocList($_REQUEST['prj_id'], User::getRoleID('Customer'))); } $tpl->assign("project_list", Project::getAll(false)); } else { $tpl->assign("show_not_allowed_msg", true); } $tpl->displayTemplate();
public function getList($fld_id) { return User::getActiveAssocList(Auth::getCurrentProject(), User::getRoleID('Viewer')); }
public function getList($fld_id) { return User::getActiveAssocList(Auth::getCurrentProject(), User::ROLE_USER); }
* 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/projects.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') { Misc::mapMessages(Project::insert(), array(1 => array(ev_gettext('Thank you, the project was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the new project.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this new project.'), Misc::MSG_ERROR))); } elseif (@$_POST['cat'] == 'update') { Misc::mapMessages(Project::update(), array(1 => array(ev_gettext('Thank you, the project was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the project information.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this project.'), Misc::MSG_ERROR))); } elseif (@$_POST['cat'] == 'delete') { Misc::mapMessages(Project::remove(), array(1 => array(ev_gettext('Thank you, the project was deleted successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to delete the project.'), Misc::MSG_ERROR))); } $tpl->assign('active_projects', Project::getAssocList(Auth::getUserID(), true)); if (@$_GET['cat'] == 'edit') { $tpl->assign('info', Project::getDetails($_GET['id'])); } $tpl->assign('list', Project::getList()); $tpl->assign('user_options', User::getActiveAssocList()); $tpl->assign('status_options', Status::getAssocList()); $tpl->assign('customer_backends', CRM::getBackendList()); $tpl->assign('workflow_backends', Workflow::getBackendList()); $tpl->displayTemplate();
Auth::checkAuthentication(APP_COOKIE); $tpl->assign("type", "groups"); $role_id = Auth::getCurrentRole(); if ($role_id == User::getRoleID('administrator') || $role_id == User::getRoleID('manager')) { if ($role_id == User::getRoleID('administrator')) { $tpl->assign("show_setup_links", true); } if (@$HTTP_POST_VARS["cat"] == "new") { $tpl->assign("result", Group::insert()); } elseif (@$HTTP_POST_VARS["cat"] == "update") { $tpl->assign("result", Group::update()); } elseif (@$HTTP_POST_VARS["cat"] == "delete") { Group::remove(); } if (@$HTTP_GET_VARS["cat"] == "edit") { $info = Group::getDetails($HTTP_GET_VARS["id"]); $tpl->assign("info", $info); } $user_options = User::getActiveAssocList(false, NULL, false, false, true); if (@$HTTP_GET_VARS['show_customers'] == 1) { $show_customer = true; } else { $show_customer = false; } $tpl->assign("user_options", $user_options); $tpl->assign("list", Group::getList()); $tpl->assign("project_list", Project::getAll()); } else { $tpl->assign("show_not_allowed_msg", true); } $tpl->displayTemplate();
/** * Returns data on when support emails are sent/recieved. * * @access public * @param string $timezone Timezone to display time in in addition to GMT * @param boolean $graph If the data should be formatted for use in a graph. Default false * @return array An array of data. */ function getEmailWorkloadByTimePeriod($timezone, $graph = false) { // get total counts $stmt = "SELECT\n hour(sup_date) AS time_period,\n count(*) as events\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "support_email\n GROUP BY\n time_period"; $total = $GLOBALS["db_api"]->dbh->getAssoc($stmt); if (PEAR::isError($total)) { Error_Handler::logError(array($total->getMessage(), $total->getDebugInfo()), __FILE__, __LINE__); return array(); } // get all developer email addresses $users = User::getActiveAssocList(Auth::getCurrentProject(), User::getRoleID("customer")); $emails = array(); foreach ($users as $usr_id => $usr_full_name) { $emails[] = Misc::escapeString(User::getFromHeader($usr_id)); } // get number of support emails from developers $stmt = "SELECT\n hour(sup_date) AS time_period,\n count(*) as events\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "support_email\n WHERE\n sup_from IN('" . join("','", $emails) . "')\n GROUP BY\n time_period"; $dev_stats = $GLOBALS["db_api"]->dbh->getAssoc($stmt); if (PEAR::isError($dev_stats)) { Error_Handler::logError(array($dev_stats->getMessage(), $dev_stats->getDebugInfo()), __FILE__, __LINE__); return array(); } // get total number of developer and customer events and build cust_stats array $dev_count = 0; $cust_count = 0; $cust_stats = array(); for ($i = 0; $i < 24; $i++) { if (empty($dev_stats[$i])) { $dev_stats[$i] = 0; } $cust_stats[$i] = @$total[$i] - @$dev_stats[$i]; $cust_count += @$total[$i] - @$dev_stats[$i]; $dev_count += @$dev_stats[$i]; } $data = array(); $sort_values = array(); for ($i = 0; $i < 24; $i++) { // convert to the users time zone $dt = new Date(mktime($i, 0, 0)); $gmt_time = $dt->format('%H:%M'); $dt->convertTZbyID($timezone); if ($graph) { $data["developer"][$dt->format('%H')] = ""; $data["customer"][$dt->format('%H')] = ""; } else { $data[$i]["display_time_gmt"] = $gmt_time; $data[$i]["display_time_user"] = $dt->format('%H:%M'); } // use later to find highest value $sort_values["developer"][$i] = $dev_stats[$i]; $sort_values["customer"][$i] = $cust_stats[$i]; if ($graph) { if ($dev_count == 0) { $data["developer"][$dt->format('%H')] = 0; } else { $data["developer"][$dt->format('%H')] = $dev_stats[$i] / $dev_count * 100; } if ($cust_count == 0) { $data["customer"][$dt->format('%H')] = 0; } else { $data["customer"][$dt->format('%H')] = $cust_stats[$i] / $cust_count * 100; } } else { $data[$i]["developer"]["count"] = $dev_stats[$i]; if ($dev_count == 0) { $data[$i]["developer"]["percentage"] = 0; } else { $data[$i]["developer"]["percentage"] = $dev_stats[$i] / $dev_count * 100; } $data[$i]["customer"]["count"] = $cust_stats[$i]; if ($cust_count == 0) { $data[$i]["customer"]["percentage"] = 0; } else { $data[$i]["customer"]["percentage"] = $cust_stats[$i] / $cust_count * 100; } } } if (!$graph) { // get the highest action times foreach ($sort_values as $performer => $values) { arsort($values); reset($values); $data[key($values)][$performer]["rank"] = 1; } } return $data; }
$role_id = Auth::getCurrentRole(); if ($role_id < User::getRoleID('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 = Group::insert(); Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the group was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the new group.'), Misc::MSG_ERROR))); } elseif (@$_POST['cat'] == 'update') { $res = Group::update(); Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the group was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the group.'), Misc::MSG_ERROR))); } elseif (@$_POST['cat'] == 'delete') { Group::remove(); } if (@$_GET['cat'] == 'edit') { $info = Group::getDetails($_GET['id']); $tpl->assign('info', $info); $user_options = User::getActiveAssocList(Auth::getCurrentProject(), User::getRoleID('customer'), false, $_GET['id']); } else { $user_options = User::getActiveAssocList(Auth::getCurrentProject(), User::getRoleID('customer'), true); } if (@$_GET['show_customers'] == 1) { $show_customer = true; } else { $show_customer = false; } $tpl->assign('user_options', $user_options); $tpl->assign('list', Group::getList()); $tpl->assign('project_list', Project::getAll()); $tpl->displayTemplate();
require_once dirname(__FILE__) . '/../../init.php'; $tpl = new Template_Helper(); $tpl->setTemplate('manage/reminder_actions.tpl.html'); Auth::checkAuthentication(APP_COOKIE); $rem_id = @$_POST['rem_id'] ? $_POST['rem_id'] : $_GET['rem_id']; $role_id = Auth::getCurrentRole(); if ($role_id < User::getRoleID('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 = Reminder_Action::insert(); Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the action was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the new action.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this new action.'), Misc::MSG_ERROR))); } elseif (@$_POST['cat'] == 'update') { $res = Reminder_Action::update(); Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the action was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the action.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this action.'), Misc::MSG_ERROR))); } elseif (@$_POST['cat'] == 'delete') { @Reminder_Action::remove($_POST['items']); } if (@$_GET['cat'] == 'edit') { $tpl->assign('info', Reminder_Action::getDetails($_GET['id'])); } elseif (@$_GET['cat'] == 'change_rank') { Reminder_Action::changeRank($_GET['rem_id'], $_GET['id'], $_GET['rank']); } $tpl->assign('rem_id', $rem_id); $tpl->assign('rem_title', Reminder::getTitle($rem_id)); $tpl->assign('action_types', Reminder_Action::getActionTypeList()); $tpl->assign('list', Reminder_Action::getAdminList($rem_id)); $tpl->assign('user_options', User::getActiveAssocList(Reminder::getProjectID($rem_id), User::getRoleID('Customer'))); $tpl->displayTemplate();
require_once __DIR__ . '/../../init.php'; $tpl = new Template_Helper(); $tpl->setTemplate('manage/reminder_actions.tpl.html'); Auth::checkAuthentication(); $rem_id = @$_POST['rem_id'] ? $_POST['rem_id'] : $_GET['rem_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'] == 'new') { $res = Reminder_Action::insert(); Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the action was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the new action.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this new action.'), Misc::MSG_ERROR))); } elseif (@$_POST['cat'] == 'update') { $res = Reminder_Action::update(); Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the action was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the action.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this action.'), Misc::MSG_ERROR))); } elseif (@$_POST['cat'] == 'delete') { @Reminder_Action::remove($_POST['items']); } if (@$_GET['cat'] == 'edit') { $tpl->assign('info', Reminder_Action::getDetails($_GET['id'])); } elseif (@$_GET['cat'] == 'change_rank') { Reminder_Action::changeRank($_GET['rem_id'], $_GET['id'], $_GET['rank']); } $tpl->assign('rem_id', $rem_id); $tpl->assign('rem_title', Reminder::getTitle($rem_id)); $tpl->assign('action_types', Reminder_Action::getActionTypeList()); $tpl->assign('list', Reminder_Action::getAdminList($rem_id)); $tpl->assign('user_options', User::getActiveAssocList(Reminder::getProjectID($rem_id), User::ROLE_CUSTOMER)); $tpl->displayTemplate();