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


PHP Project::getAssocList方法代码示例

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


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

示例1: Template_API

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();
开发者ID:juliogallardo1326,项目名称:proc,代码行数:31,代码来源:projects.php

示例2: getWeeklyReport

 /**
  * @param int $week
  * @param string $start
  * @param string $end
  * @param bool $separate_closed
  * @return string
  * @access protected
  * @deprecated use getWeeklyReportData() and format data yourself
  */
 public function getWeeklyReport($week, $start, $end, $separate_closed)
 {
     $usr_id = Auth::getUserID();
     $week = abs($week);
     // we have to set a project so the template class works, even though the weekly report doesn't actually need it
     $projects = Project::getAssocList(Auth::getUserID());
     $prj_id = current(array_keys($projects));
     AuthCookie::setProjectCookie($prj_id);
     $prj_id = Auth::getCurrentProject();
     // figure out the correct week
     if (empty($start) || empty($end)) {
         $start = date('U') - Date_Helper::DAY * (date('w') - 1);
         if ($week > 0) {
             $start = $start - Date_Helper::WEEK * $week;
         }
         $end = date('Y-m-d', $start + Date_Helper::DAY * 6);
         $start = date('Y-m-d', $start);
     }
     if ($separate_closed) {
         // emulate smarty value for reports/weekly_data.tpl.tmpl:
         // {if $smarty.post.separate_closed == 1}
         $_POST['separate_closed'] = true;
     }
     $options = array('separate_closed' => $separate_closed);
     $tpl = new Template_Helper();
     $tpl->setTemplate('reports/weekly_data.tpl.html');
     $tpl->assign(array('report_type' => 'weekly', 'data' => Report::getWeeklyReport($usr_id, $prj_id, $start, $end, $options)));
     $ret = $tpl->getTemplateContents() . "\n";
     return $ret;
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:39,代码来源:RemoteApi.php

示例3: getCurrentProject

 /**
  * Gets the current selected project from the project cookie.
  *
  * @access  public
  * @return  integer The project ID
  */
 function getCurrentProject()
 {
     $cookie = Auth::getCookieInfo(APP_PROJECT_COOKIE);
     if (empty($cookie)) {
         return "";
     }
     $usr_id = Auth::getUserID();
     $projects = Project::getAssocList($usr_id);
     if ($usr_id == APP_SYSTEM_USER_ID) {
         return $cookie['prj_id'];
     }
     if (!in_array($cookie["prj_id"], array_keys($projects))) {
         Auth::redirect(APP_RELATIVE_URL . "select_project.php?err=1");
     }
     return $cookie["prj_id"];
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:22,代码来源:class.auth.php

示例4: getCurrentProject

 /**
  * Gets the current selected project from the project cookie.
  *
  * @return  integer The project ID
  */
 public static function getCurrentProject($redirect = true)
 {
     $cookie = self::getCookieInfo(APP_PROJECT_COOKIE);
     if (empty($cookie) || @$cookie['prj_id'] == false) {
         return '';
     }
     $usr_id = self::getUserID();
     $projects = Project::getAssocList($usr_id);
     if ($usr_id == APP_SYSTEM_USER_ID) {
         return isset($cookie['prj_id']) ? (int) $cookie['prj_id'] : null;
     }
     if ($projects != null && !in_array($cookie['prj_id'], array_keys($projects))) {
         if ($redirect) {
             self::redirect('select_project.php');
         } else {
             return false;
         }
     }
     return $cookie['prj_id'];
 }
开发者ID:korusdipl,项目名称:eventum,代码行数:25,代码来源:class.auth.php

示例5: notifyAccountDetails

 /**
  * Method used to send the account details of an user.
  *
  * @access  public
  * @param   integer $usr_id The user ID
  * @return  void
  */
 function notifyAccountDetails($usr_id)
 {
     $info = User::getDetails($usr_id);
     $info["projects"] = Project::getAssocList($usr_id, true, true);
     // open text template
     $tpl = new Template_API();
     $tpl->setTemplate('notifications/account_details.tpl.text');
     $tpl->bulkAssign(array("app_title" => Misc::getToolCaption(), "user" => $info));
     $text_message = $tpl->getTemplateContents();
     // send email (use PEAR's classes)
     $mail = new Mail_API();
     $mail->setTextBody($text_message);
     $setup = $mail->getSMTPSettings();
     $mail->send($setup["from"], $mail->getFormattedName($info["usr_full_name"], $info["usr_email"]), APP_SHORT_NAME . ": Your User Account Details");
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:22,代码来源:class.notification.php

示例6: getWeeklyReport

function getWeeklyReport($p)
{
    $email = XML_RPC_decode($p->getParam(0));
    $password = XML_RPC_decode($p->getParam(1));
    $auth = authenticate($email, $password);
    if (is_object($auth)) {
        return $auth;
    }
    $week = abs(XML_RPC_decode($p->getParam(2)));
    $start = XML_RPC_decode($p->getParam(3));
    $end = XML_RPC_decode($p->getParam(4));
    // we have to set a project so the template class works, even though the weekly report doesn't actually need it
    $projects = Project::getAssocList(Auth::getUserID());
    createFakeCookie($email, current(array_keys($projects)));
    // figure out the correct week
    if (empty($start) || empty($end)) {
        $start = date("U") - DAY * (date("w") - 1);
        if ($week > 0) {
            $start = $start - WEEK * $week;
        }
        $end = date("Y-m-d", $start + DAY * 6);
        $start = date("Y-m-d", $start);
    }
    $tpl = new Template_API();
    $tpl->setTemplate("reports/weekly_data.tpl.html");
    $tpl->assign("data", Report::getWeeklyReport(User::getUserIDByEmail($email), $start, $end));
    $ret = $tpl->getTemplateContents() . "\n";
    return new XML_RPC_Response(XML_RPC_Encode(base64_encode($ret)));
}
开发者ID:juliogallardo1326,项目名称:proc,代码行数:29,代码来源:xmlrpc.php

示例7: checkCustomerAuthentication

            Auth::setCurrentProject($prj_id, 0);
            checkCustomerAuthentication($prj_id);
            Auth::redirect($_GET['url']);
        }
    }
    $tpl->assign('active_projects', $assigned_projects);
}
if (@$_GET['err'] != '') {
    Auth::removeCookie(APP_PROJECT_COOKIE);
    $tpl->assign('err', $_GET['err']);
}
$select_prj = isset($_POST['cat']) && $_POST['cat'] == 'select' || isset($_GET['project']) && $_GET['project'];
if ($select_prj) {
    $prj_id = (int) (@$_POST['cat'] == 'select') ? (int) @$_POST['project'] : (int) @$_GET['project'];
    $usr_id = Auth::getUserID();
    $projects = Project::getAssocList($usr_id);
    if (!in_array($prj_id, array_keys($projects))) {
        // show error message
        $tpl->assign('err', 1);
    } else {
        // create cookie and redirect
        if (empty($_POST['remember'])) {
            $_POST['remember'] = 0;
        }
        Auth::setCurrentProject($prj_id, $_POST['remember']);
        checkCustomerAuthentication($prj_id);
        if (!empty($_POST['url'])) {
            Auth::redirect($_POST['url']);
        } else {
            Auth::redirect('list.php');
        }
开发者ID:korusdipl,项目名称:eventum,代码行数:31,代码来源:select_project.php

示例8: update


//.........这里部分代码省略.........
         Workflow::handleSeverityChange($prj_id, $issue_id, $usr_id, $current, $_POST);
     }
     if (isset($_POST['scheduled_release']) && $current['iss_pre_id'] != $_POST['scheduled_release']) {
         $updated_fields['Scheduled Release'] = History::formatChanges(Release::getTitle($current['iss_pre_id']), Release::getTitle($_POST['scheduled_release']));
     }
     if (isset($_POST['status']) && $current['iss_sta_id'] != $_POST['status']) {
         // clear out the last-triggered-reminder flag when changing the status of an issue
         Reminder_Action::clearLastTriggered($issue_id);
         // if old status was closed and new status is not, clear closed data from issue.
         $old_status_details = Status::getDetails($current['iss_sta_id']);
         if ($old_status_details['sta_is_closed'] == 1) {
             $new_status_details = Status::getDetails($_POST['status']);
             if ($new_status_details['sta_is_closed'] != 1) {
                 self::clearClosed($issue_id);
             }
         }
         $updated_fields['Status'] = History::formatChanges(Status::getStatusTitle($current['iss_sta_id']), Status::getStatusTitle($_POST['status']));
     }
     if (isset($_POST['resolution']) && $current['iss_res_id'] != $_POST['resolution']) {
         $updated_fields['Resolution'] = History::formatChanges(Resolution::getTitle($current['iss_res_id']), Resolution::getTitle($_POST['resolution']));
     }
     if (isset($_POST['estimated_dev_time']) && $current['iss_dev_time'] != $_POST['estimated_dev_time']) {
         $updated_fields['Estimated Dev. Time'] = History::formatChanges(Misc::getFormattedTime($current['iss_dev_time'] * 60), Misc::getFormattedTime($_POST['estimated_dev_time'] * 60));
     }
     if ($current['iss_summary'] != $_POST['summary']) {
         $updated_fields['Summary'] = '';
     }
     if (isset($_POST['percentage_complete']) && $current['iss_original_percent_complete'] != $_POST['percentage_complete']) {
         $updated_fields['Percentage complete'] = History::formatChanges($current['iss_original_percent_complete'], $_POST['percentage_complete']);
     }
     if ($current['iss_original_description'] != $_POST['description']) {
         $updated_fields['Description'] = '';
     }
     if (isset($_POST['private']) && $_POST['private'] != $current['iss_private']) {
         $updated_fields['Private'] = History::formatChanges(Misc::getBooleanDisplayValue($current['iss_private']), Misc::getBooleanDisplayValue($_POST['private']));
     }
     if (isset($_POST['product']) && count($product_changes) > 0) {
         $updated_fields['Product'] = implode('; ', $product_changes);
     }
     if (isset($_POST['custom_fields']) && count($_POST['custom_fields']) > 0) {
         $updated_custom_fields = Custom_Field::updateValues($issue_id, $_POST['custom_fields']);
     } else {
         $updated_custom_fields = array();
     }
     if (count($updated_fields) > 0) {
         // log the changes
         $changes = '';
         $i = 0;
         foreach ($updated_fields as $key => $value) {
             if ($i > 0) {
                 $changes .= '; ';
             }
             if ($key != 'Summary' && $key != 'Description') {
                 $changes .= "{$key}: {$value}";
             } else {
                 $changes .= "{$key}";
             }
             $i++;
         }
         History::add($issue_id, $usr_id, 'issue_updated', 'Issue updated ({changes}) by {user}', array('changes' => $changes, 'user' => User::getFullName($usr_id)));
     }
     if (count($updated_fields) > 0 || count($updated_custom_fields) > 0) {
         // send notifications for the issue being updated
         Notification::notifyIssueUpdated($issue_id, $current, $_POST, $updated_custom_fields);
     }
     // record group change as a separate change
     if (isset($_POST['group']) && $current['iss_grp_id'] != (int) $_POST['group']) {
         History::add($issue_id, $usr_id, 'group_changed', 'Group changed ({changes}) by {user}', array('changes' => History::formatChanges(Group::getName($current['iss_grp_id']), Group::getName($_POST['group'])), 'user' => User::getFullName($usr_id)));
     }
     // now update any duplicates, if any
     $update_dupe = array('Category', 'Release', 'Priority', 'Release', 'Resolution');
     $intersect = array_intersect($update_dupe, array_keys($updated_fields));
     if ($current['duplicates'] != '' && count($intersect) > 0) {
         self::updateDuplicates($issue_id);
     }
     // if there is customer integration, mark last customer action
     if (CRM::hasCustomerIntegration($prj_id) && User::getRoleByUser($usr_id, $prj_id) == User::ROLE_CUSTOMER) {
         self::recordLastCustomerAction($issue_id);
     }
     if ($assignments_changed) {
         // XXX: we may want to also send the email notification for those "new" assignees
         Workflow::handleAssignmentChange(self::getProjectID($issue_id), $issue_id, $usr_id, self::getDetails($issue_id), @$_POST['assignments'], false);
     }
     Workflow::handleIssueUpdated($prj_id, $issue_id, $usr_id, $current, $_POST);
     // Move issue to another project
     if (isset($_POST['move_issue']) and User::getRoleByUser($usr_id, $prj_id) >= User::ROLE_DEVELOPER) {
         $new_prj_id = (int) @$_POST['new_prj'];
         if ($prj_id != $new_prj_id && array_key_exists($new_prj_id, Project::getAssocList($usr_id))) {
             if (User::getRoleByUser($usr_id, $new_prj_id) >= User::ROLE_REPORTER) {
                 $res = self::moveIssue($issue_id, $new_prj_id);
                 if ($res == -1) {
                     return $res;
                 }
             } else {
                 return -1;
             }
         }
     }
     return 1;
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:101,代码来源:class.issue.php

示例9: Template_API

include_once APP_INC_PATH . "class.setup.php";
include_once APP_INC_PATH . "class.date.php";
include_once APP_INC_PATH . "db_access.php";
$tpl = new Template_API();
$tpl->setTemplate("preferences.tpl.html");
Auth::checkAuthentication(APP_COOKIE);
$usr_id = Auth::getUserID();
if (@$HTTP_POST_VARS["cat"] == "update_account") {
    $res = Prefs::set($usr_id);
    $tpl->assign('update_account_result', $res);
    User::updateSMS($usr_id, @$HTTP_POST_VARS['sms_email']);
} elseif (@$HTTP_POST_VARS["cat"] == "update_name") {
    $res = User::updateFullName($usr_id);
    $tpl->assign('update_name_result', $res);
} elseif (@$HTTP_POST_VARS["cat"] == "update_email") {
    $res = User::updateEmail($usr_id);
    $tpl->assign('update_email_result', $res);
} elseif (@$HTTP_POST_VARS["cat"] == "update_password") {
    $res = User::updatePassword($usr_id);
    $tpl->assign('update_password_result', $res);
}
$prefs = Prefs::get($usr_id);
$prefs['sms_email'] = User::getSMS($usr_id);
// if the user has no preferences set yet, get it from the system-wide options
if (empty($prefs)) {
    $prefs = Setup::load();
}
$tpl->assign("user_prefs", $prefs);
$tpl->assign("assigned_projects", Project::getAssocList($usr_id, false, true));
$tpl->assign("zones", Date_API::getTimezoneList());
$tpl->displayTemplate();
开发者ID:juliogallardo1326,项目名称:proc,代码行数:31,代码来源:preferences.php

示例10: elseif

$auto_switched_from = false;
if (!empty($iss_prj_id) && $iss_prj_id != $prj_id && in_array($iss_prj_id, $associated_projects)) {
    $cookie = Auth::getCookieInfo(APP_PROJECT_COOKIE);
    Auth::setCurrentProject($iss_prj_id, $cookie["remember"], true);
    $auto_switched_from = $prj_id;
    $prj_id = $iss_prj_id;
}
$details = Issue::getDetails($issue_id);
$tpl->assign("issue", $details);
// in the case of a customer user, also need to check if that customer has access to this issue
if ($role_id == User::getRoleID('customer') && User::getCustomerID($usr_id) != $details['iss_customer_id']) {
    $tpl->assign("auth_customer", 'denied');
} elseif (!Issue::canAccess($issue_id, $usr_id)) {
    $tpl->assign("auth_user", 'denied');
} else {
    $associated_projects = @array_keys(Project::getAssocList($usr_id));
    if (empty($details) || $details['iss_prj_id'] != $prj_id) {
        $tpl->assign('issue', '');
    } else {
        // check if the requested issue is a part of one of the projects
        // associated with this user
        if (!@in_array($details['iss_prj_id'], $associated_projects)) {
            $tpl->assign("auth_customer", 'denied');
        } else {
            $options = Issue::saveSearchParams();
            $sides = Issue::getSides($issue_id, $options);
            // check if scheduled release should be displayed
            $releases = Release::getAssocList($prj_id);
            if (count($releases) > 0) {
                $show_releases = 1;
            } else {
开发者ID:juliogallardo1326,项目名称:proc,代码行数:31,代码来源:view.php

示例11: dirname

// | Boston, MA 02110-1301, USA.                                          |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <jpm@mysql.com>                             |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../init.php';
$usr_id = Auth::getUserID();
$prj_id = Auth::getCurrentProject();
$tpl = new Template_Helper();
$tpl->setTemplate('view_email.tpl.html');
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$issue_id = Support::getIssueFromEmail($_GET['id']);
if ($issue_id != 0 && !Issue::canAccess($issue_id, $usr_id) || $issue_id == 0 && User::getRoleByUser($usr_id, $prj_id) < User::ROLE_USER) {
    $tpl->setTemplate('permission_denied.tpl.html');
    $tpl->displayTemplate();
    exit;
}
$email = Support::getEmailDetails($_GET['ema_id'], $_GET['id']);
$email['seb_body'] = str_replace('&amp;nbsp;', '&nbsp;', $email['seb_body']);
$tpl->assign(array('email' => $email, 'issue_id' => $issue_id, 'extra_title' => ev_gettext('Issue #%1$s Email #%3$s: %2$s', $issue_id, $email['sup_subject'], Support::getSequenceByID($_GET['id'])), 'email_accounts' => Email_Account::getAssocList(array_keys(Project::getAssocList(Auth::getUserID())), true), 'recipients' => Mail_Queue::getMessageRecipients(array('customer_email', 'other_email'), $_GET['id'])));
if (@$_GET['cat'] == 'list_emails') {
    $sides = Support::getListingSides($_GET['id']);
    $tpl->assign(array('previous' => $sides['previous'], 'next' => $sides['next']));
} elseif (@$_GET['cat'] == 'move_email' && Auth::getCurrentRole() >= User::getRoleID('Standard User')) {
    $res = Support::moveEmail(@$_GET['id'], @$_GET['ema_id'], @$_GET['new_ema_id']);
    $tpl->assign('move_email_result', $res);
    $tpl->assign('current_user_prefs', Prefs::get(Auth::getUserID()));
} else {
    $sides = Support::getIssueSides($issue_id, $_GET['id']);
    $tpl->assign(array('previous' => $sides['previous'], 'next' => $sides['next']));
}
$tpl->displayTemplate();
开发者ID:korusdipl,项目名称:eventum,代码行数:31,代码来源:view_email.php

示例12: notifyAccountDetails

 /**
  * Method used to send the account details of an user.
  *
  * @param   integer $usr_id The user ID
  * @return  void
  */
 public function notifyAccountDetails($usr_id)
 {
     $info = User::getDetails($usr_id);
     $info['projects'] = Project::getAssocList($usr_id, true, true);
     // open text template
     $tpl = new Template_Helper();
     $tpl->setTemplate('notifications/account_details.tpl.text');
     $tpl->assign(array('app_title' => Misc::getToolCaption(), 'user' => $info));
     Language::set(User::getLang($usr_id));
     $text_message = $tpl->getTemplateContents();
     // send email (use PEAR's classes)
     $mail = new Mail_Helper();
     $mail->setTextBody($text_message);
     $setup = $mail->getSMTPSettings();
     $to = $mail->getFormattedName($info['usr_full_name'], $info['usr_email']);
     // TRANSLATORS: %s = APP_SHORT_NAME
     $subject = ev_gettext('%s: Your User Account Details', APP_SHORT_NAME);
     $mail->send($setup['from'], $to, $subject);
     Language::restore();
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:26,代码来源:class.notification.php

示例13: getList

 /**
  * Method used to get the list of users available in the system.
  *
  * @access  public
  * @param   boolean $show_customers Whether to return customers or not
  * @return  array The list of users
  */
 function getList($show_customers)
 {
     $stmt = "SELECT\n                    *\n                 FROM\n                    " . ETEL_USER_TABLE . "\n                 WHERE\n                    usr_id != " . APP_SYSTEM_USER_ID . "\n                 ORDER BY\n                    usr_status ASC,\n                    usr_full_name ASC";
     $res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC);
     if (PEAR::isError($res)) {
         Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
         return "";
     } else {
         $data = array();
         $count = count($res);
         for ($i = 0; $i < $count; $i++) {
             $roles = Project::getAssocList($res[$i]['usr_id'], false, true);
             $role = current($roles);
             $role = $role['pru_role'];
             if ($show_customers == false && (@$roles[Auth::getCurrentProject()]['pru_role'] == User::getRoleID("Customer") || count($roles) == 1 && $role == User::getRoleID("Customer"))) {
                 continue;
             }
             $row = $res[$i];
             $row["roles"] = $roles;
             if (!empty($res[$i]["usr_grp_id"])) {
                 $row["group_name"] = Group::getName($res[$i]["usr_grp_id"]);
             }
             $data[] = $row;
         }
         return $data;
     }
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:34,代码来源:class.user.php

示例14: getList

 /**
  * Method used to get the list of users available in the system.
  *
  * @param   boolean $show_customers Whether to return customers or not
  * @return  array The list of users
  */
 public static function getList($show_customers, $show_inactive)
 {
     // FIXME: what about other statuses like "pending"?
     $stmt = 'SELECT
                 *
              FROM
                 {{%user}}
              WHERE
                 usr_id != ?';
     $params = array(APP_SYSTEM_USER_ID);
     if (!$show_inactive) {
         $stmt .= ' AND usr_status != ?';
         $params[] = 'inactive';
     }
     $stmt .= '
             ORDER BY
                 usr_status ASC,
                 usr_full_name ASC';
     try {
         $res = DB_Helper::getInstance()->getAll($stmt, $params);
     } catch (DbException $e) {
         return '';
     }
     $data = array();
     foreach ($res as &$row) {
         $roles = Project::getAssocList($row['usr_id'], false, true);
         $role = current($roles);
         $role = $role['pru_role'];
         if ($show_customers == false && (@$roles[Auth::getCurrentProject()]['pru_role'] == self::getRoleID('Customer') || count($roles) == 1 && $role == self::getRoleID('Customer'))) {
             continue;
         }
         $row['roles'] = $roles;
         if (!empty($row['usr_grp_id'])) {
             $row['group_name'] = Group::getName($row['usr_grp_id']);
         }
         if (!empty($row['usr_par_code'])) {
             $row['partner_name'] = Partner::getName($row['usr_par_code']);
         }
         // add email aliases
         $row['aliases'] = User::getAliases($row['usr_id']);
         $data[] = $row;
     }
     return $data;
 }
开发者ID:korusdipl,项目名称:eventum,代码行数:50,代码来源:class.user.php

示例15: processTemplate

 /**
  * Processes the template and assign common variables automatically.
  * @return $this
  */
 private function processTemplate()
 {
     $core = array('rel_url' => APP_RELATIVE_URL, 'base_url' => APP_BASE_URL, 'app_title' => APP_NAME, 'app_version' => APP_VERSION, 'app_setup' => Setup::load(), 'messages' => Misc::getMessages(), 'roles' => User::getAssocRoleIDs(), 'auth_backend' => APP_AUTH_BACKEND, 'current_url' => $_SERVER['PHP_SELF']);
     // If VCS version is present "Eventum 2.3.3-148-g78b3368", link ref to github
     $vcsVersion = self::getVcsVersion();
     if ($vcsVersion) {
         $link = "https://github.com/eventum/eventum/commit/{$vcsVersion}";
         $core['application_version_link'] = $link;
         // append VCS version if not yet there
         if (!preg_match('/-g[0-9a-f]+$/', APP_VERSION)) {
             $core['app_version'] = "v{$core['app_version']}-g{$vcsVersion}";
         }
     }
     $usr_id = Auth::getUserID();
     if ($usr_id) {
         $core['user'] = User::getDetails($usr_id);
         $prj_id = Auth::getCurrentProject();
         $setup = Setup::load();
         if (!empty($prj_id)) {
             $role_id = User::getRoleByUser($usr_id, $prj_id);
             $has_crm = CRM::hasCustomerIntegration($prj_id);
             $core = $core + array('project_id' => $prj_id, 'project_name' => Auth::getCurrentProjectName(), 'has_crm' => $has_crm, 'current_role' => $role_id, 'current_role_name' => User::getRole($role_id), 'feature_access' => Access::getFeatureAccessArray($usr_id));
             if ($has_crm) {
                 $crm = CRM::getInstance($prj_id);
                 $core['crm_template_path'] = $crm->getTemplatePath();
                 if ($role_id == User::getRoleID('Customer')) {
                     try {
                         $contact = $crm->getContact($core['user']['usr_customer_contact_id']);
                         $core['allowed_customers'] = $contact->getCustomers();
                         $core['current_customer'] = $crm->getCustomer(Auth::getCurrentCustomerID(false));
                     } catch (CRMException $e) {
                     }
                 }
             }
         }
         $info = User::getDetails($usr_id);
         $raw_projects = Project::getAssocList(Auth::getUserID(), false, true);
         $active_projects = array();
         foreach ($raw_projects as $prj_id => $prj_info) {
             if ($prj_info['status'] == 'archived') {
                 $prj_info['prj_title'] .= ' ' . ev_gettext('(archived)');
             }
             $active_projects[$prj_id] = $prj_info['prj_title'];
         }
         $core = $core + array('active_projects' => $active_projects, 'current_full_name' => $info['usr_full_name'], 'current_email' => $info['usr_email'], 'current_user_id' => $usr_id, 'current_user_datetime' => Date_Helper::getISO8601date('now', '', true), 'is_current_user_clocked_in' => User::isCLockedIn($usr_id), 'is_anon_user' => Auth::isAnonUser(), 'is_current_user_partner' => !empty($info['usr_par_code']), 'roles' => User::getAssocRoleIDs(), 'current_user_prefs' => Prefs::get(Auth::getUserID()));
         $this->assign('current_full_name', $core['user']['usr_full_name']);
         $this->assign('current_email', $core['user']['usr_email']);
         $this->assign('current_user_id', $usr_id);
         $this->assign('handle_clock_in', $setup['handle_clock_in'] == 'enabled');
         $this->assign('is_current_user_clocked_in', User::isClockedIn($usr_id));
         $this->assign('roles', User::getAssocRoleIDs());
     }
     $this->assign('core', $core);
     return $this;
 }
开发者ID:korusdipl,项目名称:eventum,代码行数:59,代码来源:class.template_helper.php


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