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


PHP user_get_preference函数代码示例

本文整理汇总了PHP中user_get_preference函数的典型用法代码示例。如果您正苦于以下问题:PHP user_get_preference函数的具体用法?PHP user_get_preference怎么用?PHP user_get_preference使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: hide_url

/**
 * Generate url to Expend/Collapse a part of a page
 * @see my_hide_url
 */
function hide_url($svc, $db_item_id, $defaultHide = false, $hide = null)
{
    $pref_name = 'hide_' . $svc . $db_item_id;
    if (empty($hide)) {
        $hide = $_REQUEST['hide_' . $svc];
    }
    $noPref = false;
    $old_hide = user_get_preference($pref_name);
    // Make sure they are both 0 if never set before
    if ($old_hide == false) {
        $noPref = true;
        $old_hide = 0;
    }
    // If no given value for hide, keep the old one
    if (!isset($hide)) {
        $hide = $old_hide;
    }
    // Update pref value if needed
    if ($old_hide != $hide) {
        user_set_preference($pref_name, $hide);
    }
    if ($hide == 2 || $noPref && $defaultHide) {
        $hide_url = 'hide_' . $svc . '=1&hide_item_id=' . $db_item_id;
        $hide_img = '<img src="' . util_get_image_theme("pointer_right.png") . '" align="middle" border="0" alt="Expand">';
        $hide_now = true;
    } else {
        $hide_url = 'hide_' . $svc . '=2&hide_item_id=' . $db_item_id;
        $hide_img = '<img src="' . util_get_image_theme("pointer_down.png") . '" align="middle" border="0" alt="Collapse">';
        $hide_now = false;
    }
    return array($hide_now, $hide_url, $hide_img);
}
开发者ID:sunmoonone,项目名称:tuleap,代码行数:36,代码来源:PHPWikiViews.class.php

示例2: __construct

 function __construct()
 {
     parent::__construct(self::ID);
     $this->artifact_show = user_get_preference(self::PREF_SHOW);
     if ($this->artifact_show === false) {
         $this->artifact_show = 'AS';
         user_set_preference(self::PREF_SHOW, $this->artifact_show);
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:9,代码来源:Tracker_Widget_MyArtifacts.class.php

示例3: Widget_MyArtifacts

 function Widget_MyArtifacts()
 {
     $this->Widget('myartifacts');
     $this->_artifact_show = user_get_preference('my_artifacts_show');
     if ($this->_artifact_show === false) {
         $this->_artifact_show = 'AS';
         user_set_preference('my_artifacts_show', $this->_artifact_show);
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:9,代码来源:Widget_MyArtifacts.class.php

示例4: __construct

 /**
  * Constructor of the class
  *
  * @param String $pluginPath Path of plugin git
  *
  * @return Void
  */
 public function __construct($pluginPath)
 {
     $this->pluginPath = $pluginPath;
     $this->Widget('plugin_git_user_pushes');
     $this->offset = user_get_preference('plugin_git_user_pushes_offset');
     if (empty($this->offset)) {
         $this->offset = 5;
     }
     $this->pastDays = user_get_preference('plugin_git_user_pushes_past_days');
     if (empty($this->pastDays)) {
         $this->pastDays = 30;
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:20,代码来源:Git_Widget_UserPushes.class.php

示例5: __construct

 /**
  * Constructor
  *
  * @param Int              $group_id   The owner id
  * @param hudsonPlugin     $plugin     The plugin
  * @param HudsonJobFactory $factory    The HudsonJob factory
  * 
  * @return void
  */
 function __construct($group_id, hudsonPlugin $plugin, HudsonJobFactory $factory)
 {
     parent::__construct('plugin_hudson_project_jobsoverview', $factory);
     $this->setOwner($group_id, WidgetLayoutManager::OWNER_TYPE_GROUP);
     $this->plugin = $plugin;
     $request =& HTTPRequest::instance();
     $this->group_id = $request->get('group_id');
     $this->_use_global_status = user_get_preference('plugin_hudson_use_global_status' . $this->group_id);
     if ($this->_use_global_status === false) {
         $this->_use_global_status = "false";
         user_set_preference('plugin_hudson_use_global_status' . $this->group_id, $this->_use_global_status);
     }
     if ($this->_use_global_status == "true") {
         $this->_all_status = array('grey' => 0, 'blue' => 0, 'yellow' => 0, 'red' => 0);
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:25,代码来源:hudson_Widget_ProjectJobsOverview.class.php

示例6: my_hide

function my_hide($svc, $db_item_id, $item_id, $hide)
{
    $pref_name = 'my_hide_' . $svc . $db_item_id;
    $old_pref_value = user_get_preference($pref_name);
    list($old_hide, $old_count) = explode('|', $old_pref_value);
    // Make sure they are both 0 if never set before
    if ($old_hide == false) {
        $old_hide = 0;
    }
    if ($item_id == $db_item_id) {
        if (!isset($hide)) {
            $hide = $old_hide;
        }
    } else {
        $hide = $old_hide;
    }
    return $hide;
}
开发者ID:nterray,项目名称:tuleap,代码行数:18,代码来源:my_utils.php

示例7: fetchPrefs

 /**
  * function to set user preferences
  *
  * 	@return null
  */
 function fetchPrefs()
 {
     $prefs = array();
     $advsrch = 0;
     $morder = "";
     $report_id = 100;
     //if (user_isloggedin()) {
     $custom_pref = user_get_preference('artifact_brow_cust' . $this->atid);
     if ($custom_pref) {
         $pref_arr = explode('&', substr($custom_pref, 1));
         while (list(, $expr) = each($pref_arr)) {
             // Extract left and right parts of the assignment
             // and remove the '[]' array symbol from the left part
             list($field, $value_id) = explode('=', $expr);
             $field = str_replace('[]', '', $field);
             if ($field == 'advsrch') {
                 $advsrch = $value_id ? 1 : 0;
             } else {
                 if ($field == 'msort') {
                     $msort = $value_id ? 1 : 0;
                 } else {
                     if ($field == 'chunksz') {
                         $chunksz = $value_id;
                     } else {
                         if ($field == 'report_id') {
                             $report_id = $value_id;
                         } else {
                             $prefs[$field][] = urldecode($value_id);
                         }
                     }
                 }
             }
             //echo '<br>DBG restoring prefs : $prefs['.$field.'] []='.$value_id;
         }
     }
     $morder = user_get_preference('artifact_browse_order' . $this->atid);
     //}
     $this->prefs = $prefs;
     $this->advsrch = $advsrch;
     $this->morder = $morder;
     $this->report_id = $report_id;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:47,代码来源:GraphicEngineUserPrefs.class.php

示例8: __construct

 /**
  * Constructor
  *
  * @param Int              $user_id    The owner id
  * @param hudsonPlugin     $plugin     The plugin
  * @param HudsonJobFactory $factory    The HudsonJob factory
  * 
  * @return void
  */
 function __construct($user_id, hudsonPlugin $plugin, HudsonJobFactory $factory)
 {
     parent::__construct('plugin_hudson_my_jobs', $factory);
     $this->setOwner($user_id, WidgetLayoutManager::OWNER_TYPE_USER);
     $this->plugin = $plugin;
     $this->_not_monitored_jobs = user_get_preference('plugin_hudson_my_not_monitored_jobs');
     if ($this->_not_monitored_jobs === false) {
         $this->_not_monitored_jobs = array();
     } else {
         $this->_not_monitored_jobs = explode(",", $this->_not_monitored_jobs);
     }
     $this->_use_global_status = user_get_preference('plugin_hudson_use_global_status');
     if ($this->_use_global_status === false) {
         $this->_use_global_status = "false";
         user_set_preference('plugin_hudson_use_global_status', $this->_use_global_status);
     }
     if ($this->_use_global_status == "true") {
         $this->_all_status = array('grey' => 0, 'blue' => 0, 'yellow' => 0, 'red' => 0);
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:29,代码来源:hudson_Widget_MyMonitoredJobs.class.php

示例9: get_csv_separator

/**
 * Get the CSV separator defined in the Account Maintenance preferences
 *
 * @return string the CSV separator defined by the user or "," by default if the user didn't defined it
 */
function get_csv_separator()
{
    if ($u_separator = user_get_preference("user_csv_separator")) {
    } else {
        $u_separator = PFUser::DEFAULT_CSV_SEPARATOR;
    }
    $separator = '';
    switch ($u_separator) {
        case 'comma':
            $separator = ",";
            break;
        case 'semicolon':
            $separator = ";";
            break;
        case 'tab':
            $separator = "\t";
            break;
        default:
            $separator = PFUser::DEFAULT_CSV_SEPARATOR;
            break;
    }
    return $separator;
}
开发者ID:rinodung,项目名称:tuleap,代码行数:28,代码来源:project_export_utils.php

示例10: Valid_UInt

<?php

require_once 'pre.php';
$valid = new Valid_UInt('tracker_id');
$valid->required();
if ($request->valid($valid)) {
    if (user_get_preference('tracker_comment_invertorder_' . $request->get('tracker_id'))) {
        user_del_preference('tracker_comment_invertorder_' . $request->get('tracker_id'));
    } else {
        user_set_preference('tracker_comment_invertorder_' . $request->get('tracker_id'), '1');
    }
}
开发者ID:nterray,项目名称:tuleap,代码行数:12,代码来源:invert_comments_order.php

示例11: user_getid

        $set = 'open';
    }
}
if ($set == 'my') {
    /*
    	My requests - backwards compat can be removed 9/10
    */
    $_status = 1;
    $_assigned_to = user_getid();
} else {
    if ($set == 'custom') {
        /*
        	if this custom set is different than the stored one, reset preference
        */
        $pref_ = $_assigned_to . '|' . $_status . '|' . $_category;
        if ($pref_ != user_get_preference('sup_brow_cust' . $group_id)) {
            //echo 'setting pref';
            user_set_preference('sup_brow_cust' . $group_id, $pref_);
        }
    } else {
        if ($set == 'closed') {
            /*
            	Closed requests - backwards compat can be removed 9/10
            */
            $_assigned_to = 0;
            $_status = '2';
        } else {
            /*
            	Open requests - backwards compat can be removed 9/10
            */
            $_assigned_to = 0;
开发者ID:BackupTheBerlios,项目名称:berlios,代码行数:31,代码来源:browse_support.php

示例12: getPreferences

 function getPreferences()
 {
     $prefs = '';
     $prefs .= $GLOBALS['Language']->getText('my_index', 'my_latest_svn_commit_nb_prefs');
     $prefs .= ' <input name="nb_svn_commits" type="text" size="2" maxlenght="3" value="' . user_get_preference('my_latests_svn_commits_nb_display') . '">';
     return $prefs;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:Widget_MyLatestSvnCommits.class.php

示例13: db_ei

     $sql .= " AND user_group.group_id = " . db_ei($in_project) . " ";
 }
 if ($search || $begin) {
     $sql .= ' AND ( ';
     if ($search) {
         $sql .= " user.realname LIKE '%" . db_es($search) . "%' OR user.user_name LIKE '%" . db_es($search) . "%' OR user.email LIKE '%" . db_es($search) . "%' ";
         if ($begin) {
             $sql .= " OR ";
         }
     }
     if ($begin) {
         $sql .= " user.realname LIKE '" . db_es($begin) . "%' OR user.user_name LIKE '" . db_es($begin) . "%' OR user.email LIKE '" . db_es($begin) . "%' ";
     }
     $sql .= " ) ";
 }
 $sql .= "ORDER BY " . (user_get_preference("username_display") > 1 ? 'realname' : 'user_name') . "\n                LIMIT " . db_ei($offset) . ", " . db_ei($number_per_page);
 //echo $sql;
 $res = db_query($sql);
 $res2 = db_query('SELECT FOUND_ROWS() as nb');
 $num_total_rows = db_result($res2, 0, 'nb');
 display_user_result_table($res);
 //Jump to page
 $nb_of_pages = ceil($num_total_rows / $number_per_page);
 $current_page = round($offset / $number_per_page);
 echo '<div style="font-family:Verdana">Page: ';
 $width = 10;
 for ($i = 0; $i < $nb_of_pages; ++$i) {
     if ($i == 0 || $i == $nb_of_pages - 1 || $current_page - $width / 2 <= $i && $i <= $width / 2 + $current_page) {
         echo '<a href="?' . 'group_id=' . (int) $group_id . '&amp;ugroup_id=' . (int) $ugroup_id . '&amp;offset=' . (int) ($i * $number_per_page) . '&amp;number_per_page=' . (int) $number_per_page . '&amp;search=' . urlencode($search) . '&amp;begin=' . urlencode($begin) . '&amp;in_project=' . (int) $in_project . '">';
         if ($i == $current_page) {
             echo '<b>' . ($i + 1) . '</b>';
开发者ID:nickl-,项目名称:tuleap,代码行数:31,代码来源:ugroup_add_users.php

示例14: showFollowUpComments

 /**
  * Return the string to display the follow ups comments 
  *
  * @param Integer   group_id: the group id
  * @param Integer   output By default set to OUTPUT_BROWSER, the output is displayed on browser 
  *                         set to OUTPUT_MAIL_TEXT, the followups will be sent in mail 
  *                         else is an export csv/DB
  * @return string the follow-up comments to display in HTML or in ascii mode
  */
 function showFollowUpComments($group_id, $pv, $output = self::OUTPUT_BROWSER)
 {
     $hp = $this->getHTMLPurifier();
     $uh = UserHelper::instance();
     //
     //  Format the comment rows from artifact_history
     //
     global $Language;
     //$group = $this->ArtifactType->getGroup();
     $group_artifact_id = $this->ArtifactType->getID();
     //$group_id = $group->getGroupId();
     $result = $this->getFollowups();
     $rows = db_numrows($result);
     // No followup comment -> return now
     if ($rows <= 0) {
         if ($output == self::OUTPUT_EXPORT || $output == self::OUTPUT_MAIL_TEXT) {
             $out = $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . " " . $Language->getText('tracker_import_utils', 'no_followups') . $GLOBALS['sys_lf'];
         } else {
             $out = '<H4>' . $Language->getText('tracker_import_utils', 'no_followups') . '</H4>';
         }
         return $out;
     }
     $out = '';
     // Header first
     if ($output == self::OUTPUT_EXPORT || $output == self::OUTPUT_MAIL_TEXT) {
         $out .= $Language->getText('tracker_include_artifact', 'follow_ups') . $GLOBALS['sys_lf'] . str_repeat("*", strlen($Language->getText('tracker_include_artifact', 'follow_ups')));
     } else {
         if ($rows > 0) {
             $out .= '<div style="text-align:right">';
             $out .= '<script type="text/javascript">
                 function tracker_expand_all_comments() {
                     $H(tracker_comment_togglers).values().each(function (value) {
                             (value)(null, true, true);
                     });
                 }
                 
                 function tracker_collapse_all_comments() {
                     $H(tracker_comment_togglers).values().each(function (value) {
                             (value)(null, true, false);
                     });
                 }
                 var matches = location.hash.match(/#comment_(\\d*)/);
                 var linked_comment_id = matches ? matches[1] : null;
                 </script>';
             $out .= '<a href="#expand_all" onclick="tracker_expand_all_comments(); return false;">' . $Language->getText('tracker_include_artifact', 'expand_all') . '</a> | <a href="#expand_all" onclick="tracker_collapse_all_comments(); return false;">' . $Language->getText('tracker_include_artifact', 'collapse_all') . '</a></div>';
         }
     }
     // Loop throuh the follow-up comments and format them
     $last_visit_date = user_get_preference('tracker_' . $this->ArtifactType->getId() . '_artifact_' . $this->getId() . '_last_visit');
     for ($i = 0; $i < $rows; $i++) {
         $comment_type = db_result($result, $i, 'comment_type');
         $comment_type_id = db_result($result, $i, 'comment_type_id');
         $comment_id = db_result($result, $i, 'artifact_history_id');
         $field_name = db_result($result, $i, 'field_name');
         $orig_subm = $this->getOriginalCommentSubmitter($comment_id);
         $orig_date = $this->getOriginalCommentDate($comment_id);
         $value = db_result($result, $i, 'new_value');
         $isHtml = db_result($result, $i, 'format');
         if ($comment_type_id == 100 || $comment_type == "") {
             $comment_type = '';
         } else {
             $comment_type = '[' . SimpleSanitizer::unsanitize($comment_type) . ']';
         }
         if ($output == self::OUTPUT_EXPORT || $output == self::OUTPUT_MAIL_TEXT) {
             $fmt = $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . "------------------------------------------------------------------" . $GLOBALS['sys_lf'] . $Language->getText('tracker_import_utils', 'date') . ": %-30s" . $Language->getText('global', 'by') . ": %s" . $GLOBALS['sys_lf'] . "%s";
             //The mail body
             $comment_txt = $this->formatFollowUp($group_id, $isHtml, $value, $output);
             $out .= sprintf($fmt, format_date(util_get_user_preferences_export_datefmt(), db_result($orig_date, 0, 'date')), db_result($orig_subm, 0, 'mod_by') == 100 ? db_result($orig_subm, 0, 'email') : user_getname(db_result($orig_subm, 0, 'mod_by')), ($comment_type != '' ? $comment_type . $GLOBALS['sys_lf'] : '') . $comment_txt);
         } else {
             $style = '';
             $toggle = 'ic/toggle_minus.png';
             if ($last_visit_date > db_result($orig_date, 0, 'date') && $i > 0) {
                 $style = 'style="display:none;"';
                 $toggle = 'ic/toggle_plus.png';
             }
             $out .= "\n" . '
                 <div class="followup_comment" id="comment_' . $comment_id . '">
                     <div class="' . util_get_alt_row_color($i) . ' followup_comment_header">
                         <div class="followup_comment_title">';
             $out .= '<script type="text/javascript">document.write(\'<span>';
             $out .= $GLOBALS['HTML']->getImage($toggle, array('id' => 'comment_' . (int) $comment_id . '_toggle', 'style' => 'vertical-align:middle; cursor:hand; cursor:pointer;', 'title' => addslashes($GLOBALS['Language']->getText('tracker_include_artifact', 'toggle'))));
             $out .= '</span>\');</script>';
             $out .= '<script type="text/javascript">';
             $out .= "tracker_comment_togglers[" . (int) $comment_id . "] = function (evt, force, expand) {\n                        var toggle = \$('comment_" . (int) $comment_id . "_toggle');\n                        var element = \$('comment_" . (int) $comment_id . "_content');\n                        if (element) {\n                            if (!force || (expand && !element.visible()) || (!expand && element.visible())) {\n                                Element.toggle(element);\n                                \n                                //replace image\n                                var src_search = 'toggle_minus';\n                                var src_replace = 'toggle_plus';\n                                if (toggle.src.match('toggle_plus')) {\n                                    src_search = 'toggle_plus';\n                                    src_replace = 'toggle_minus';\n                                }\n                                toggle.src = toggle.src.replace(src_search, src_replace);\n                            }\n                        }\n                        if (evt) {\n                            Event.stop(evt);\n                        }\n                        return false;\n                    };\n                    Event.observe(\$('comment_" . (int) $comment_id . "_toggle'), 'click', tracker_comment_togglers[" . (int) $comment_id . "]);";
             $out .= '</script>';
             $out .= '<span><a href="#comment_' . (int) $comment_id . '" title="Link to this comment - #' . (int) $comment_id . '" onclick="tracker_comment_togglers[' . (int) $comment_id . '](null, true, true);">';
             $out .= $GLOBALS['HTML']->getImage('ic/comment.png', array('border' => 0, 'style' => 'vertical-align:middle', 'title' => 'Link to this comment - #' . (int) $comment_id));
             $out .= '</a> </span>';
             $out .= '<span class="followup_comment_title_user">';
             if (db_result($orig_subm, 0, 'mod_by') == 100) {
                 $out .= db_result($orig_subm, 0, 'email');
//.........这里部分代码省略.........
开发者ID:nterray,项目名称:tuleap,代码行数:101,代码来源:Artifact.class.php

示例15: searchUsersToAdd

 /**
  * Search users to add to ugroup
  *
  * @param Integer $ugroupId Id of the uGroup
  * @param Array   $filters  List of filters
  *
  * @return Array
  */
 public function searchUsersToAdd($ugroupId, $filters)
 {
     $ugroup_id = $this->da->escapeInt($ugroupId);
     $offset = $this->da->escapeInt($filters['offset']);
     $number_per_page = $this->da->escapeInt($filters['number_per_page']);
     $order_by = user_get_preference("username_display") > 1 ? 'realname' : 'user_name';
     $join_user_group = $this->getJoinUserGroup($filters);
     $and_username_filter = $this->getUsernameFilter($filters);
     $sql = "SELECT SQL_CALC_FOUND_ROWS user.user_id, user_name, realname, email, IF(R.user_id = user.user_id, 1, 0) AS is_on\n                FROM user\n                    NATURAL LEFT JOIN (SELECT user_id FROM ugroup_user WHERE ugroup_id = {$ugroup_id} ) AS R\n                    {$join_user_group}\n                WHERE status in ('A', 'R')\n                  {$and_username_filter}\n                ORDER BY {$order_by}\n                LIMIT {$offset}, {$number_per_page}";
     $res = $this->retrieve($sql);
     $res2 = $this->retrieve('SELECT FOUND_ROWS() as nb');
     $numTotalRows = $res2->getRow();
     return array('result' => $res, 'num_total_rows' => $numTotalRows['nb']);
 }
开发者ID:rinodung,项目名称:tuleap,代码行数:22,代码来源:UGroupUserDao.class.php


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