本文整理汇总了PHP中User::getCurrentUser方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getCurrentUser方法的具体用法?PHP User::getCurrentUser怎么用?PHP User::getCurrentUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类User
的用法示例。
在下文中一共展示了User::getCurrentUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFields
public function getFields(Tracker_Artifact $artifact)
{
$diplayed_fields = array();
$tracker_id = $artifact->getTrackerId();
foreach ($this->displayed_fields as $diplayed_field_name) {
$field = $this->form_element_factory->getUsedFieldByNameForUser($tracker_id, $diplayed_field_name, $this->user_manager->getCurrentUser());
if ($field) {
$diplayed_fields[] = $field;
}
}
return $diplayed_fields;
}
示例2: getGeneratedUrl
/**
* Return the IFrame URL generated by parsing the data in the URL field.
*
* @return string HTML code for the administration interface
*/
private function getGeneratedUrl()
{
$patterns = array('/\\{node_id\\}/', '/\\{user_id\\}/', '/\\{last_viewed\\}/');
$current_node = Node::getCurrentNode();
if ($current_node) {
$node_id = $current_node->getId();
} else {
$node_id = '';
}
$current_user = User::getCurrentUser();
if ($current_user) {
$user_id = $current_user->getId();
} else {
$user_id = '';
}
$user_last_viewed_ts = $this->getLastDisplayTimestamp($current_user);
if ($user_last_viewed_ts) {
$user_last_viewed = date('c', $user_last_viewed_ts);
} else {
$user_last_viewed = null;
}
$replacements = array(urlencode($node_id), urlencode($user_id), urlencode($user_last_viewed));
$url = $this->getUrl();
$new_url = preg_replace($patterns, $replacements, $url);
return $new_url;
}
示例3: getDetailAction
/**
* 获取自驾游详情
* @param $id
*/
public function getDetailAction($id)
{
$tour = Activity::getDrivingTourDetailById($id);
$user = User::getCurrentUser();
$is_user_join = Activity::isUserJoin($user['user_id'], $id);
$tour['is_user_join'] = $is_user_join;
$this->view->setVars(array('row' => $tour));
}
示例4: getDetailAction
/**
* 获取指定id的活动详情
* @param $id
*/
public function getDetailAction($id)
{
$activity = Activity::getActivityDetailById($id);
$user = User::getCurrentUser();
$is_user_join = Activity::isUserJoin($user['user_id'], $id);
//更新浏览次数
Activity::updateActivityViewNum($id);
$activity['is_user_join'] = $is_user_join;
$this->view->setVars(array('row' => $activity));
}
示例5: getUserInfoAction
/**
* 获取用户信息
* @param string $user_id
*/
public function getUserInfoAction($user_id = 'me')
{
$user = null;
if ($user_id == 'me') {
$user = User::getCurrentUser();
} else {
$user = User::getUserInfoById($user_id);
}
$this->view->setVar('row', $user);
}
示例6: getListAction
/**
* 获取收藏数据列表
*/
public function getListAction()
{
$page_num = $this->request->get('page');
$page_size = $this->request->get('rows');
$criteria = array();
$user = User::getCurrentUser();
$criteria['user_id'] = $user['user_id'];
$collection_list = Collection::getList($criteria, $page_num, $page_size);
$collection_total = Collection::getCount($criteria);
$this->view->setVars(array('total' => $collection_total, 'count' => count($collection_list), 'rows' => $collection_list));
}
示例7: actionToggleMatchNotifications
public function actionToggleMatchNotifications()
{
if (User::isCurrentUserAdmin()) {
$bit = intval($_GET['value']);
$bit = $bit == 0 ? 1 : 0;
$mod = new MatchNotification();
$mod->status = $bit;
$mod->date_modified = date('Y-m-d H:i:s');
$userinfo = User::getCurrentUser();
$mod->userid = $userinfo['id'];
$mod->save();
$userid = $mod->getUserId();
$user = User::model()->find("id=:id", array(':id' => $userid));
$state = $mod->isGlobalNotificationOn() ? '1' : '0';
$data = array('userid' => $userid, 'status' => $state, 'last_modified' => $mod->getLastDate(), 'username' => $user['username']);
echo CJSON::encode($data);
}
}
示例8: replaceHyperLinks
/** Replace all hyperlinks in the source string with their clickthrough-logged equivalents */
public static function replaceHyperLinks(&$string, Content &$content)
{
$matches = self::findHyperLinks($string);
//pretty_print_r($matches);
if (!empty($matches[2])) {
$node = Node::getCurrentNode();
$user = User::getCurrentUser();
$i = 0;
foreach ($matches[2] as $link) {
$new_link = self::getClickThroughLink($link, $content, $node, $user);
$replacements[] = $matches[1][$i] . $new_link . $matches[3][$i];
$i++;
}
//pretty_print_r($replacements);
return str_replace($matches[0], $replacements, $string);
} else {
return $string;
}
}
示例9: processAdminUI
/**
* Processes the input of the administration interface for Picture
*
* @return void
*/
public function processAdminUI()
{
if ($this->DEPRECATEDisOwner(User::getCurrentUser()) || User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
parent::processAdminUI();
if ($this->configEnableHyperlink) {
$this->setHyperlinkUrl($_REQUEST["pictures_{$this->getId()}_hyperlink_url"]);
}
if ($this->configEnableEditWidthHeight) {
$this->setWidth(intval($_REQUEST["pictures_{$this->getId()}_width"]));
$this->setHeight(intval($_REQUEST["pictures_{$this->getId()}_height"]));
}
}
}
示例10: processAdminUI
/**
* Processes the input of the administration interface for RssAggregator
*
* @return void
*/
public function processAdminUI()
{
if ($this->DEPRECATEDisOwner(User::getCurrentUser()) || User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
parent::processAdminUI();
/*
* number_of_display_items
*/
$name = "rss_aggregator_" . $this->id . "_display_num_items";
$this->setDisplayNumItems($_REQUEST[$name]);
/*
* algorithm_strength
*/
$name = "rss_aggregator_" . $this->id . "_algorithm_strength";
$this->setAlgorithmStrength($_REQUEST[$name]);
/*
* feed_expansion
*/
$name = "rss_aggregator_" . $this->id . "_feed_expansion";
$this->setFeedExpansionMode($_REQUEST[$name]);
/*
* feed_ordering
*/
$name = "rss_aggregator_" . $this->id . "_feed_ordering";
$this->setFeedOrdering($_REQUEST[$name]);
/*
* display_empty_feeds
*/
$name = "rss_aggregator_" . $this->id . "_display_empty_feeds";
!empty($_REQUEST[$name]) ? $this->setDisplayEmptyFeed(true) : $this->setDisplayEmptyFeed(false);
/*
* max_item_age
*/
$name = "rss_aggregator_" . $this->id . "_max_item_age";
$this->setMaxItemAge($_REQUEST[$name]);
foreach ($this->content_rss_aggregator_feeds_rows as $feed_row) {
$this->processFeedAdminUI($feed_row);
/*
* Delete feeds
*/
$name = "rss_aggregator_" . $this->id . "_feed_" . md5($feed_row['url']) . "_delete";
if (isset($_REQUEST[$name])) {
$this->removeFeed($feed_row['url']);
}
}
/*
* Add new feed
*/
$name = "rss_aggregator_{$this->id}_feed_add";
if (!empty($_REQUEST[$name])) {
$this->addFeed($_REQUEST[$name]);
}
}
}
示例11: getClockInInfoAction
/**
* 获取签到信息
* @param null $user_id
*/
public function getClockInInfoAction($user_id = null)
{
$user = User::getCurrentUser();
$clock_in = ClockIn::getClockIn($user['user_id']);
$this->view->setVars(array('row' => $clock_in));
}
示例12: renderContent
protected function renderContent()
{
$this->render('userMenu', array('isInstagramUser' => User::model()->isInstagram(Yii::app()->user->id), 'user' => User::getCurrentUser()));
}
示例13: delete
/**
* @see GenericObject
* @internal Persistent content will not be deleted
*/
public function delete(&$errmsg)
{
$retval = false;
if ($this->isPersistent()) {
$errmsg = _("Content is persistent (you must make it non persistent before you can delete it)");
} else {
$db = AbstractDb::getObject();
if ($this->DEPRECATEDisOwner(User::getCurrentUser()) || User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
$sql = "DELETE FROM content WHERE content_id='{$this->id}'";
$db->execSqlUpdate($sql, false);
//Metadata mmust be deleted AFTER the main content.
$errmsgTmp = null;
$metadata = $this->getTitle();
if ($metadata) {
$metadata->delete($errmsgTmp);
}
$errmsg .= $errmsgTmp;
$errmsgTmp = null;
$metadata = $this->getDescription();
if ($metadata) {
$metadata->delete($errmsgTmp);
}
$errmsg .= $errmsgTmp;
$errmsgTmp = null;
$metadata = $this->getLongDescription();
if ($metadata) {
$metadata->delete($errmsgTmp);
}
$errmsg .= $errmsgTmp;
$errmsgTmp = null;
$metadata = $this->getProjectInfo();
if ($metadata) {
$metadata->delete($errmsgTmp);
}
$errmsg .= $errmsgTmp;
$retval = true;
} else {
$errmsg = _("Access denied (not owner of content)");
}
}
return $retval;
}
示例14: delete
/**
* Deletes a Langstring object
*
* @param string $errmsg Reference to error message
*
* @return bool True if deletion was successful
* @internal Persistent content will not be deleted
*/
public function delete(&$errmsg)
{
// Init values.
$_retval = false;
if ($this->isPersistent()) {
$errmsg = _("Content is persistent (you must make it non persistent before you can delete it)");
} else {
$db = AbstractDb::getObject();
if ($this->DEPRECATEDisOwner(User::getCurrentUser()) || User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
$sql = "DELETE FROM content WHERE content_id='{$this->id}'";
$db->execSqlUpdate($sql, false);
$_retval = true;
// Create new cache object.
$_cache = new Cache('all', $this->id);
// Check if caching has been enabled.
if ($_cache->isCachingEnabled) {
// Remove old cached data.
$_cache->eraseCachedGroupData();
}
} else {
$errmsg = _("Access denied (not owner of content)");
}
}
return $_retval;
}
示例15: processAdminUI
/**
* Processes the input of the administration interface for Picture
*
* @return void
*/
public function processAdminUI()
{
if ($this->DEPRECATEDisOwner(User::getCurrentUser()) || User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
parent::processAdminUI();
/* width and height */
$name = "banner_add_group_{this->getId()}_widthxheight";
$widthxheight = FormSelectGenerator::getResult($name, null);
//pretty_print_r($widthxheight);
$name = "banner_add_group_{this->getId()}_max_width";
$max_width = $_REQUEST[$name];
/*max_height*/
$name = "banner_add_group_{this->getId()}_max_height";
$max_height = $_REQUEST[$name];
if (!empty($widthxheight)) {
$widthxheightArray = explode('/', $widthxheight);
$max_width_select = $widthxheightArray[0];
$max_height_select = $widthxheightArray[1];
if (($max_width_select != $max_width || $max_height_select != $max_height) && ($max_width == $this->getKVP(get_class($this) . '_max_width') && $max_height == $this->getKVP(get_class($this) . '_max_height'))) {
/* Width and height weren't manually changed, or were empty */
$max_width = $max_width_select;
$max_height = $max_height_select;
}
}
$this->setKVP(get_class($this) . '_max_width', $max_width);
$this->setKVP(get_class($this) . '_max_height', $max_height);
}
}