本文整理汇总了PHP中Prefs::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Prefs::get方法的具体用法?PHP Prefs::get怎么用?PHP Prefs::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Prefs
的用法示例。
在下文中一共展示了Prefs::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _createContent
/**
* Commentaires d'une procedure
*
* @author Christophe Beyer <cbeyer@cap-tic.fr>
* @since 2008/01/30
* @param object $rFiche Recordset de la procedure
*/
public function _createContent(&$toReturn)
{
$tpl = new CopixTpl();
$rFiche = $this->getParam('rFiche');
$mondroit = $this->getParam('mondroit');
$daoinfo =& _dao('infosupp');
$sql = 'SELECT * FROM module_teleprocedure_infosupp WHERE idinter=' . $rFiche->idinter . '';
$canCheckVisible = TeleproceduresService::canMakeInTelep('CHECK_VISIBLE', $mondroit);
$canAddComment = TeleproceduresService::canMakeInTelep('ADD_COMMENT', $mondroit);
if (!$canCheckVisible) {
$sql .= " AND info_message!='' AND info_message IS NOT NULL";
}
$sql .= " ORDER BY dateinfo ASC, idinfo ASC";
$results = _doQuery($sql);
// Pour chaque message on cherche les infos de son auteur
$list = array();
foreach ($results as $r) {
$userInfo = Kernel::getUserInfo("ID", $r->iduser);
//var_dump($userInfo);
$avatar = Prefs::get('prefs', 'avatar', $r->iduser);
$userInfo['avatar'] = $avatar ? CopixConfig::get('prefs|avatar_path') . $avatar : '';
$r->user = $userInfo;
$list[] = $r;
}
//print_r($rFiche);
$tpl->assign('info_message_edition', CopixZone::process('kernel|edition', array('field' => 'info_message', 'format' => $rFiche->type_format, 'content' => '', 'width' => 350, 'height' => 135, 'options' => array('toolbarSet' => 'IconitoBasic', 'enterMode' => 'br', 'toolbarStartupExpanded' => 'false'))));
$tpl->assign('info_commentaire_edition', CopixZone::process('kernel|edition', array('field' => 'info_commentaire', 'format' => $rFiche->type_format, 'content' => '', 'width' => 350, 'height' => 135, 'options' => array('toolbarSet' => 'IconitoBasic', 'enterMode' => 'br', 'toolbarStartupExpanded' => 'false'))));
$tpl->assign('canCheckVisible', $canCheckVisible);
$tpl->assign('canAddComment', $canAddComment);
$tpl->assign('list', $list);
$tpl->assign('rFiche', $rFiche);
$toReturn = $tpl->fetch('fiche-comms-zone.tpl');
return true;
}
示例2: _createContent
/**
* Affiche la fiche détaillée d'un utilisateur (login, nom, prénom...)
*
* @author Christophe Beyer <cbeyer@cap-tic.fr>
* @since 2006/01/04
* @param string $type Type de personne (USER_ELE, USER_ELE...)
* @param integer $id Id
*/
public function _createContent(&$toReturn)
{
$annuaireService =& CopixClassesFactory::Create('annuaire|AnnuaireService');
$type = $this->getParam('type') ? $this->getParam('type') : NULL;
$id = $this->getParam('id') ? $this->getParam('id') : NULL;
$canWrite = $canView = false;
if ($type && $id) {
$usr = Kernel::getUserInfo($type, $id);
$usr['type_nom'] = Kernel::Code2Name($usr['type']);
//Kernel::myDebug($usr);
$droits = Kernel::getUserInfoMatrix($usr);
$canView = $droits['voir'];
$canWrite = $droits['communiquer'];
if ($canView) {
// Avatar
$avatar = '';
if (isset($usr['user_id'])) {
$avatar = Prefs::get('prefs', 'avatar', $usr['user_id']);
}
$usr['avatar'] = $avatar ? CopixConfig::get('prefs|avatar_path') . $avatar : '';
$parents = $enfants = array();
if ($type == 'USER_ELE') {
// Pour un élève, on cherche ses parents
$parents = $annuaireService->getParentsFromEleve($id);
} elseif ($type == 'USER_RES') {
// Pour un parent, on cherche ses enfants
$enfants = $annuaireService->getEnfantsFromParent($id);
}
} else {
$usr = $parents = $enfants = false;
}
$tpl = new CopixTpl();
$tpl->assign('usr', $usr);
$tpl->assign('canWrite', $canWrite);
$tpl->assign('parents', $parents);
$tpl->assign('enfants', $enfants);
$toReturn = $tpl->fetch('getuserprofilzone.tpl');
}
return true;
}
示例3: execute
function execute()
{
if (Config::lpStoreRedis) {
$key = get_class() . ':' . $this->typeID . ',' . $this->qty;
$cache = json_decode($this->bpcCache->get($key), true);
if (empty($cache) || empty($cache['manDetails']) || $cache['version'] != Db::$dbName) {
$cache = array('version' => Db::$dbName, 'manDetails' => $this->performQuery());
$this->bpcCache->set($key, json_encode($cache));
}
} else {
$cache = array('version' => Db::$dbName, 'manDetails' => $this->performQuery());
}
# set price info for manufacturing materials
foreach ($cache['manDetails'] as &$manItem) {
try {
$price = new Price(Emdr::get($manItem['typeID']));
$manItem['price'] = $price->{Prefs::get('marketMat')}[0];
$manItem['totPrice'] = $manItem['price'] * $manItem['totQty'];
} catch (Exception $e) {
array_push($this->noCache, $manItem['typeName']);
}
}
return $cache['manDetails'];
}
示例4: Template_API
// | |
// | Free Software Foundation, Inc. |
// | 59 Temple Place - Suite 330 |
// | Boston, MA 02111-1307, USA. |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <jpm@mysql.com> |
// +----------------------------------------------------------------------+
//
// @(#) $Id$
//
include_once "config.inc.php";
include_once APP_INC_PATH . "class.template.php";
include_once APP_INC_PATH . "class.auth.php";
include_once APP_INC_PATH . "class.time_tracking.php";
include_once APP_INC_PATH . "db_access.php";
$tpl = new Template_API();
$tpl->setTemplate("add_time_tracking.tpl.html");
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$issue_id = @$HTTP_POST_VARS["issue_id"] ? $HTTP_POST_VARS["issue_id"] : $HTTP_GET_VARS["iss_id"];
if (!Issue::canAccess($issue_id, Auth::getUserID())) {
$tpl = new Template_API();
$tpl->setTemplate("permission_denied.tpl.html");
$tpl->displayTemplate();
exit;
}
if (@$HTTP_POST_VARS["cat"] == "add_time") {
$res = Time_Tracking::insertEntry();
$tpl->assign("time_add_result", $res);
}
$tpl->assign(array("issue_id" => $issue_id, "time_categories" => Time_Tracking::getAssocCategories(), "current_user_prefs" => Prefs::get(Auth::getUserID())));
$tpl->displayTemplate();
示例5: Template_Helper
$usr_id = Auth::getUserID();
$tpl = new Template_Helper();
$tpl->setTemplate('file_upload.tpl.html');
$issue_id = isset($_POST['issue_id']) ? $_POST['issue_id'] : $_GET['iss_id'];
$cat = isset($_POST['cat']) ? $_POST['cat'] : null;
// handle uploads
if ($cat == 'upload_file') {
// attachment status (public or internal)
$status = isset($_POST['status']) ? $_POST['status'] : null;
$internal_only = $status == 'internal';
// from ajax upload, attachment file ids
$iaf_ids = !empty($_POST['iaf_ids']) ? explode(',', $_POST['iaf_ids']) : null;
// description for attachments
$file_description = isset($_POST['file_description']) ? $_POST['file_description'] : null;
// if no iaf_ids passed, perhaps it's old style upload
// TODO: verify that the uploaded file(s) owner is same as attachment owner.
if (!$iaf_ids && isset($_FILES['attachment'])) {
$iaf_ids = Attachment::addFiles($_FILES['attachment']);
}
try {
Attachment::attachFiles($issue_id, $usr_id, $iaf_ids, $internal_only, $file_description);
$res = 1;
} catch (Exception $e) {
error_log($e->getMessage());
error_log($e->getTraceAsString());
$res = -1;
}
$tpl->assign('upload_file_result', $res);
}
$tpl->assign(array('issue_id' => $issue_id, 'current_user_prefs' => Prefs::get(Auth::getUserID()), 'max_attachment_size' => Attachment::getMaxAttachmentSize(), 'max_attachment_bytes' => Attachment::getMaxAttachmentSize(true)));
$tpl->displayTemplate();
示例6: elseif
if (!@empty($HTTP_POST_VARS['new_status'])) {
$res = Issue::setStatus($issue_id, $HTTP_POST_VARS['new_status']);
if ($res != -1) {
$new_status = Status::getStatusTitle($HTTP_POST_VARS['new_status']);
History::add($issue_id, $usr_id, History::getTypeID('status_changed'), "Status changed to '{$new_status}' by " . User::getFullName($usr_id));
}
}
$res = Note::insert($usr_id, $issue_id);
$tpl->assign("post_result", $res);
// enter the time tracking entry about this phone support entry
if (!empty($HTTP_POST_VARS['time_spent'])) {
$HTTP_POST_VARS['issue_id'] = $issue_id;
$HTTP_POST_VARS['category'] = $HTTP_POST_VARS['time_category'];
$HTTP_POST_VARS['summary'] = 'Time entry inserted when sending an internal note.';
Time_Tracking::insertEntry();
}
} elseif (@$HTTP_GET_VARS["cat"] == "reply") {
if (!@empty($HTTP_GET_VARS["id"])) {
$note = Note::getDetails($HTTP_GET_VARS["id"]);
$date = Misc::formatReplyDate($note["timestamp"]);
$header = "\n\n\nOn {$date}, " . $note["not_from"] . " wrote:\n>\n";
$note["not_body"] = $header . Misc::formatReply($note["not_note"]);
$tpl->bulkAssign(array("note" => $note, "parent_note_id" => $HTTP_GET_VARS["id"]));
$reply_subject = Mail_API::removeExcessRe($note['not_title']);
}
}
if (empty($reply_subject)) {
$reply_subject = 'Re: ' . $details['iss_summary'];
}
$tpl->assign(array('from' => User::getFromHeader($usr_id), 'users' => Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer')), 'current_user_prefs' => Prefs::get($usr_id), 'subscribers' => Notification::getSubscribers($issue_id, false, User::getRoleID("Standard User")), 'statuses' => Status::getAssocStatusList($prj_id, false), 'current_issue_status' => Issue::getStatusID($issue_id), 'time_categories' => Time_Tracking::getAssocCategories(), 'note_category_id' => Time_Tracking::getCategoryID('Note Discussion'), 'reply_subject' => $reply_subject));
$tpl->displayTemplate();
示例7: notifyNewAssignment
/**
* Method used to send an email notification when an issue is
* assigned to an user.
*
* @param array $users The list of users
* @param integer $issue_id The issue ID
*/
public static function notifyNewAssignment($users, $issue_id)
{
$prj_id = Issue::getProjectID($issue_id);
$emails = array();
foreach ($users as $usr_id) {
if ($usr_id == Auth::getUserID()) {
continue;
}
$prefs = Prefs::get($usr_id);
if (!empty($prefs) && isset($prefs['receive_assigned_email'][$prj_id]) && $prefs['receive_assigned_email'][$prj_id] && $usr_id != Auth::getUserID()) {
$emails[] = User::getFromHeader($usr_id);
}
}
if (!$emails) {
return;
}
// get issue details
$issue = Issue::getDetails($issue_id);
// open text template
$tpl = new Template_Helper();
$tpl->setTemplate('notifications/assigned.tpl.text');
$tpl->assign(array('app_title' => Misc::getToolCaption(), 'issue' => $issue, 'current_user' => User::getFullName(Auth::getUserID())));
foreach ($emails as $email) {
$text_message = $tpl->getTemplateContents();
Language::set(User::getLang(User::getUserIDByEmail(Mail_Helper::getEmailAddress($email))));
$subject = "[#{$issue_id}] New Assignment: " . $issue['iss_summary'];
$from = self::getFixedFromHeader($issue_id, '', 'issue');
// send email (use PEAR's classes)
$mail = new Mail_Helper();
$mail->setTextBody($text_message);
$mail->setHeaders(Mail_Helper::getBaseThreadingHeaders($issue_id));
$mail->send($from, $email, $subject, true, $issue_id, 'assignment');
}
Language::restore();
}
示例8: array_keys
}
$customer_id = Issue::getCustomerID($HTTP_GET_VARS['issue']);
if (!empty($customer_id)) {
$contact_emails = array_keys(Customer::getContactEmailAssocList($prj_id, $customer_id));
$unknown_contacts = array();
foreach ($sender_emails as $email => $address) {
if (!@in_array($email, $contact_emails)) {
$usr_id = User::getUserIDByEmail($email);
if (empty($usr_id)) {
$unknown_contacts[] = $address;
} else {
// if we got a real user ID, check if the customer user is the correct one
// (i.e. a contact from the customer associated with the selected issue)
if (User::getRoleByUser($usr_id, $prj_id) == User::getRoleID('Customer')) {
// also check if the associated customer ID, if any, matches the one in the issue
$user_customer_id = User::getCustomerID($usr_id);
if ($user_customer_id != $customer_id) {
$unknown_contacts[] = $address;
}
}
}
}
}
if (count($unknown_contacts) > 0) {
$tpl->assign('unknown_contacts', $unknown_contacts);
}
}
}
}
$tpl->assign("current_user_prefs", Prefs::get(Auth::getUserID()));
$tpl->displayTemplate();
示例9: DEFINE
// comment this out for local debug copy
require_once 'Savant3.php';
# taken from http://stackoverflow.com/a/12583387/788054
# TBS cannot use DEFINE(), so these are variables
define('ABS_PATH', str_replace('\\', '/', dirname(__FILE__)) . '/');
define('BASE_PATH', '/' . substr(dirname(__FILE__), strlen($_SERVER['DOCUMENT_ROOT'])) . '/');
# to be deprecated - currently strongly discouraged in official documentation -gg
#function __autoload($class) {
# require_once('lib/' . str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php');
#}
# new style using spl_autoload_register:
spl_autoload_register(function ($class) {
require_once 'lib/' . str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
});
Emdr::$regions = json_decode(file_get_contents(ABS_PATH . '/emdr/regions.json'), true);
Prefs::getInstance();
$tpl = new Savant3();
$tpl->addPath('template', 'templates/bootstrap');
$tpl->addPath('resource', 'lib');
$tpl->siteTime = new Timer();
$tpl->emdrDown = false;
# https://forums.eveonline.com/default.aspx?g=posts&m=2508255
$regions = json_decode(file_get_contents(dirname(__FILE__) . '/emdr/regions.json'), true);
Emdr::setRegion(Prefs::get('region'));
# If price of Tritanium is more than 12 hours old, then something has happened with EMDR consumer
# Set template variable to display warning to user when this happens
if (time() - (new Price(Emdr::get(34)))->generatedAt > 60 * 60 * 12) {
$tpl->emdrDown = true;
}
$tpl->webkitFix = preg_match("#.+WebKit/(\\H+)+\\s.+?#s", $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] < 535 ? true : false;
示例10: bpcCalc
private function bpcCalc()
{
if (!$this->bpc) {
return;
}
# Something's gone wrong, don't do this if not a BPC
# Do this in template
// $name = "1 x ".$offer['typeName']." Copy (".$offer['quantity']." run".($offer['quantity'] > 1 ? "s" : null).")";
$this->manTypeID = Db::qColumn('
SELECT `productTypeID`
FROM `industryActivityProducts`
WHERE `typeID` = :typeID
AND `activityID` = 1', array(':typeID' => $this->offerDetails['typeID']));
# set pricing info per the manufactured item
try {
$price = new Price(Emdr::get($this->manTypeID));
$this->cached = true;
$this->price = $price->{Prefs::get('marketOffer')}[0];
$this->totVolume = $price->{Prefs::get('marketOffer')}[1];
$this->timeDiff = (time() - $price->generatedAt) / 60 / 60;
# time difference in hours
} catch (Exception $e) {
array_push($this->noCache, $this->offerDetails['typeName']);
}
# find cached result of BPC manufacturing materials
$this->manDetails = (new Query_OfferMaterials($this->offerDetails['typeID'], $this->offerDetails['quantity']))->execute();
# set market group to BPs (doesn't happen automatically since you can't find LP Store BPs on market)
$this->offerDetails['marketRoot'] = '2';
}
示例11: dirname
// | 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: |
// | |
// | Free Software Foundation, Inc. |
// | 51 Franklin Street, Suite 330 |
// | Boston, MA 02110-1301, USA. |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <jpm@mysql.com> |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('add_phone_entry.tpl.html');
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$issue_id = @$_POST['issue_id'] ? $_POST['issue_id'] : $_GET['iss_id'];
if (!Issue::canAccess($issue_id, Auth::getUserID()) || Auth::getCurrentRole() <= User::getRoleID('Customer')) {
$tpl = new Template_Helper();
$tpl->setTemplate('permission_denied.tpl.html');
$tpl->displayTemplate();
exit;
}
if (@$_POST['cat'] == 'add_phone') {
$res = Phone_Support::insert();
$tpl->assign('add_phone_result', $res);
}
$prj_id = Issue::getProjectID($issue_id);
$usr_id = Auth::getUserID();
$tpl->assign(array('issue_id' => $issue_id, 'phone_categories' => Phone_Support::getCategoryAssocList($prj_id), 'current_user_prefs' => Prefs::get($usr_id)));
$tpl->displayTemplate();
示例12: 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;
}
示例13: elseif
$tpl->assign("delete_phone_result", $res);
} elseif (@$HTTP_GET_VARS["cat"] == "new_status") {
// XXX: need to call the workflow api in the following function?
$res = Issue::setStatus($HTTP_GET_VARS["iss_id"], $HTTP_GET_VARS["new_sta_id"], true);
if ($res == 1) {
History::add($HTTP_GET_VARS["iss_id"], $usr_id, History::getTypeID('status_changed'), "Issue manually set to status '" . Status::getStatusTitle($HTTP_GET_VARS["new_sta_id"]) . "' by " . User::getFullName($usr_id));
}
$tpl->assign("new_status_result", $res);
} elseif (@$HTTP_GET_VARS["cat"] == "new_category") {
$res = Issue::setCategory($HTTP_GET_VARS["iss_id"], $HTTP_GET_VARS["iss_prc_id"], true);
if ($res == 1) {
History::add($HTTP_GET_VARS["iss_id"], $usr_id, History::getTypeID('status_changed'), "Issue manually set to category '" . Category::getTitle($HTTP_GET_VARS["iss_prc_id"]) . "' by " . User::getFullName($usr_id));
}
$tpl->assign("new_status_result", $res);
} elseif (@$HTTP_GET_VARS["cat"] == "new_project") {
$res = Issue::setProject($HTTP_GET_VARS["iss_id"], $HTTP_GET_VARS["iss_prj_id"], true);
if ($res == 1) {
History::add($HTTP_GET_VARS["iss_id"], $usr_id, History::getTypeID('status_changed'), "Issue manually set to project '" . Project::getName($HTTP_GET_VARS["iss_prj_id"]) . "' by " . User::getFullName($usr_id));
}
$tpl->assign("new_status_result", $res);
} elseif (@$HTTP_GET_VARS['cat'] == 'authorize_reply') {
$res = Authorized_Replier::addUser($HTTP_GET_VARS["iss_id"], $usr_id);
$tpl->assign('authorize_reply_result', $res);
} elseif (@$HTTP_GET_VARS['cat'] == 'remove_quarantine') {
if (Auth::getCurrentRole() > User::getRoleID('Developer')) {
$res = Issue::setQuarantine($HTTP_GET_VARS['iss_id'], 0);
$tpl->assign('remove_quarantine_result', $res);
}
}
$tpl->assign("current_user_prefs", Prefs::get($usr_id));
$tpl->displayTemplate();
示例14: getWeeklyReport
/**
* Returns the data used by the weekly report.
*
* @access public
* @param string $usr_id The ID of the user this report is for.
* @param string The start date of this report.
* @param string The end date of this report.
* @param boolean If closed issues should be separated from other issues.
* @return array An array of data containing all the elements of the weekly report.
*/
function getWeeklyReport($usr_id, $start, $end, $separate_closed = false)
{
$usr_id = Misc::escapeInteger($usr_id);
// figure out timezone
$user_prefs = Prefs::get($usr_id);
$tz = @$user_prefs["timezone"];
$start_dt = new Date();
$end_dt = new Date();
// set timezone to that of user.
$start_dt->setTZById($tz);
$end_dt->setTZById($tz);
// set the dates in the users time zone
$start_dt->setDate($start . " 00:00:00");
$end_dt->setDate($end . " 23:59:59");
// convert time to GMT
$start_dt->toUTC();
$end_dt->toUTC();
$start_ts = $start_dt->getDate();
$end_ts = $end_dt->getDate();
$time_tracking = Time_Tracking::getSummaryByUser($usr_id, $start_ts, $end_ts);
// replace spaces in index with _ and calculate total time
$total_time = 0;
foreach ($time_tracking as $category => $data) {
unset($time_tracking[$category]);
$time_tracking[str_replace(" ", "_", $category)] = $data;
$total_time += $data["total_time"];
}
// get count of issues assigned in week of report.
$stmt = "SELECT\n COUNT(*)\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue,\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user,\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "status\n WHERE\n iss_id = isu_iss_id AND\n iss_sta_id = sta_id AND\n isu_usr_id = {$usr_id} AND\n isu_assigned_date BETWEEN '{$start_ts}' AND '{$end_ts}'";
$newly_assigned = $GLOBALS["db_api"]->dbh->getOne($stmt);
if (PEAR::isError($newly_assigned)) {
Error_Handler::logError(array($newly_assigned->getMessage(), $newly_assigned->getDebugInfo()), __FILE__, __LINE__);
}
$email_count = array("associated" => Support::getSentEmailCountByUser($usr_id, $start_ts, $end_ts, true), "other" => Support::getSentEmailCountByUser($usr_id, $start_ts, $end_ts, false));
$data = array("start" => str_replace('-', '.', $start), "end" => str_replace('-', '.', $end), "user" => User::getDetails($usr_id), "group_name" => Group::getName(User::getGroupID($usr_id)), "issues" => History::getTouchedIssuesByUser($usr_id, $start_ts, $end_ts, $separate_closed), "status_counts" => History::getTouchedIssueCountByStatus($usr_id, $start_ts, $end_ts), "new_assigned_count" => $newly_assigned, "time_tracking" => $time_tracking, "email_count" => $email_count, "phone_count" => Phone_Support::getCountByUser($usr_id, $start_ts, $end_ts), "note_count" => Note::getCountByUser($usr_id, $start_ts, $end_ts), "total_time" => Misc::getFormattedTime($total_time, false));
return $data;
}
示例15: getTopic
/**
* Affiche une discussion d'un cahier de correspondance
*
* @author Christophe Beyer <cbeyer@cap-tic.fr>
* @since 2005/11/16
* @param integer $id Id de la discussion
* @param integer $eleve (option) Id de l'élève
* @param integer $print (option, 0 par défaut) Si 1, affiche la discussion au format imprimable
* @param string $go (option) Si vaut "new", redirige sur le premier message non lu de la discussion
*/
public function getTopic()
{
$dao = CopixDAOFactory::create("carnet_topics");
$kernel_service =& CopixClassesFactory::Create('kernel|kernel');
$carnet_service =& CopixClassesFactory::Create('carnet|CarnetService');
$id = $this->getRequest('id', null);
$eleve = $this->getRequest('eleve', null);
$print = $this->getRequest('print', 0);
$go = $this->getRequest('go', null);
$session = Kernel::getSessionBU();
$criticErrors = array();
if ($go == "new") {
$daoTracking = CopixDAOFactory::create("carnet|carnet_tracking2");
if ($eleve && $eleve != 'CLASSE') {
$idEleves = array($eleve);
} else {
$to = $dao->getElevesForTopic($id);
$idEleves = array();
foreach ($to as $item) {
$idEleves[] = $item->eleve;
}
}
//print_r($idEleves);
//die();
$unread = $daoTracking->getFirstUnreadMessage($id, $session['user_id'], $idEleves);
//_dump($unread[0]);
if ($unread[0]->id) {
// Il est déjà passé dans le topic
$urlReturn = CopixUrl::get('|getTopic', array('id' => $id, 'eleve' => $eleve)) . '#m' . $unread[0]->id;
} else {
// Jamais passé, on le renvoie au début du topic
$urlReturn = CopixUrl::get('|getTopic', array('id' => $id, 'eleve' => $eleve));
}
//die($urlReturn);
return new CopixActionReturn(COPIX_AR_REDIRECT, $urlReturn);
}
$topic = $dao->get($id);
$classe = $topic->classe;
$ppo = new CopixPPO();
if (!$topic) {
$criticErrors[] = CopixI18N::get('carnet|carnet.error.noTopic');
}
$matrix =& enic::get('matrixCache');
$ppo->canView_USER_RES = $matrix->classe($classe)->_right->USER_RES->voir;
$ppo->canView_USER_ENS = $matrix->classe($classe)->_right->USER_ENS->voir;
$ppo->canView_USER_ELE = $matrix->classe($classe)->_right->USER_ELE->voir;
//_dump($canWrite_USER_RES);
$mondroit = $carnet_service->getUserDroitInCarnet(array("classe" => $classe, "eleve" => $eleve));
//print_r("mondroit=$mondroit");
if (!$mondroit) {
$criticErrors[] = CopixI18N::get('kernel|kernel.error.noRights');
}
if ($criticErrors) {
return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $criticErrors), 'back' => CopixUrl::get('carnet||getCarnet', array())));
}
if (0) {
} else {
// print_r2($topic);
// 1. Infos sur le topic
$userInfo = $kernel_service->getUserInfo("ID", $topic->createur);
$topic->createur_nom = $userInfo["prenom"] . " " . $userInfo["nom"];
$topic->createur_infos = $userInfo;
$to = $dao->getElevesForTopic($topic->id);
while (list($k, ) = each($to)) {
$userInfo = $kernel_service->getUserInfo("USER_ELE", $to[$k]->eleve);
$to[$k]->eleve_infos = $userInfo["prenom"] . " " . $userInfo["nom"];
}
$topic->eleves = $to;
$topic->nb_eleves = count($to);
// Avatar de l'auteur
$avatar = Prefs::get('prefs', 'avatar', $topic->createur);
$topic->avatar = $avatar ? CopixConfig::get('prefs|avatar_path') . $avatar : '';
//print_r2($topic);
// 2. Les messages
if ($eleve && $eleve != 'CLASSE') {
// Filtrage sur un élève
$list = $dao->getListCarnetsMessagesForTopicAndEleve($id, $eleve);
$idEleves = array($eleve);
} else {
// Tous les élèves de la classe
$eleves = $carnet_service->getUserElevesInClasse($topic->classe);
$list = $dao->getListCarnetsMessagesForTopicAndEleves($id, $eleves);
//print_r($list);
$idEleves = array();
foreach ($to as $item) {
$idEleves[] = $item->eleve;
}
}
//print_r($idEleves);
while (list($k, ) = each($list)) {
//.........这里部分代码省略.........