本文整理汇总了PHP中S::user方法的典型用法代码示例。如果您正苦于以下问题:PHP S::user方法的具体用法?PHP S::user怎么用?PHP S::user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类S
的用法示例。
在下文中一共展示了S::user方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_block_canEdit
function smarty_block_canEdit($params, $content, &$smarty, &$repeat)
{
$group = $params['target']->group();
if (S::user()->hasRights($group, Rights::admin()) || S::user()->isWeb()) {
return $content;
}
}
示例2: smarty_function_grpvisibility
function smarty_function_grpvisibility($params, &$smarty)
{
$user = $params['user'];
$group = $params['group'];
$grpcoll = $user->groupVisibility($group);
$visigroup = $grpcoll->count() == 1 ? $grpcoll->first() : null;
// if $user is session user, see which visibility option is enabled
$flagselect = '';
if (S::user()->isMe($user)) {
$possib = $user->getAvailVisibilities($group);
$flagoptions = array();
foreach ($possib as $gid => $title) {
$flagoption = '<option value="' . $gid . '"';
if ($visigroup != null && $visigroup->id() == $gid) {
$flagoption .= ' selected';
}
$flagoption .= '>visible par ' . $title . '</option>';
$flagoptions[] = $flagoption;
}
$flagselect = '<select class="visiselect" name="visibility-' . $user->id() . '-' . $group->id() . '">' . implode($flagoptions) . '</select>';
}
// Get color & title
list($color, $title) = User::visibilitiesColInfo($grpcoll);
return '<form class="visicontainer" id="visiflag-' . $user->id() . '-' . $group->id() . '">' . '<div class="visiflag ' . $color . ' click" title="' . $title . '"></div>' . $flagselect . '</form>';
}
示例3: __construct
public function __construct($question, $answer1, $answer2)
{
$this->question = $question;
$this->answer1 = $answer1;
$this->answer2 = $answer2;
$this->writer = S::user();
}
示例4: assign_json_to_map
public static function assign_json_to_map(PlPage $page, $pids = null)
{
if (!is_null($pids)) {
$where = XDB::format(' AND pa.pid IN {?}', $pids);
} else {
$where = '';
}
if (!S::logged() || !S::user()->checkPerms('directory_ax')) {
$where .= " AND pa.pub = 'public'";
$name_publicity = 'public';
} else {
if (!S::user()->checkPerms('directory_private')) {
$where .= " AND pa.pub = 'ax'";
$name_publicity = 'public';
} else {
$name_publicity = 'private';
}
}
$data = XDB::rawFetchAllAssoc('SELECT pa.latitude, pa.longitude, GROUP_CONCAT(DISTINCT p.hrpid SEPARATOR \',\') AS hrpid,
GROUP_CONCAT(pd.promo SEPARATOR \',\') AS promo,
GROUP_CONCAT(DISTINCT pd.' . $name_publicity . '_name, \' (\', pd.promo, \')\' SEPARATOR \', \') AS name,
GROUP_CONCAT(DISTINCT pa.pid SEPARATOR \',\') AS pid
FROM profile_addresses AS pa
INNER JOIN profiles AS p ON (pa.pid = p.pid)
INNER JOIN profile_display AS pd ON (pd.pid = pa.pid)
WHERE pa.type = \'home\' AND p.deathdate IS NULL AND pa.latitude IS NOT NULL AND pa.longitude IS NOT NULL' . $where . '
GROUP BY pa.latitude, pa.longitude');
$page->jsonAssign('data', $data);
}
示例5: __construct
public function __construct()
{
global $globals;
parent::__construct();
// Set the default page
$this->changeTpl('platal/index.tpl');
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
$this->addJsLink('json2.js');
}
$this->addJsLink('jquery.xorg.js');
$this->addJsLink('overlib.js');
$this->addJsLink('core.js');
$this->addJsLink('xorg.js');
if ($globals->core->sentry_js_dsn) {
$this->addJsLink('raven.min.js');
}
$this->setTitle('le site des élèves et anciens élèves de l\'École polytechnique');
if (S::logged() && S::user()->checkPerms('admin')) {
$types = array(S::user()->type);
$perms = DirEnum::getOptions(DirEnum::ACCOUNTTYPES);
ksort($perms);
foreach ($perms as $type => $perm) {
if (!empty($perm) && $type != $types[0]) {
$types[] = $type;
}
}
$this->assign('account_types_list', $types);
$skins = DirEnum::getOptions(DirEnum::SKINS);
asort($skins);
$this->assign('skin_list', $skins);
}
}
示例6: run
public function run()
{
$res = XDB::query('SELECT todo_id, sent, checked, tobedone
FROM todo
WHERE uid = {?}
ORDER BY sent DESC', S::user()->id());
$array_todo = $res->fetchAllAssoc();
$this->assign('list', $array_todo);
}
示例7: run
public function run()
{
$binets = S::user()->castes()->groups()->filter('ns', Group::NS_BINET);
$frees = S::user()->castes()->groups()->filter('ns', Group::NS_FREE);
$binets->select(GroupSelect::premises());
$binets->select(GroupSelect::nb_news());
$this->assign('binets', $binets);
$this->assign('frees', $frees);
$this->assign('user', S::user());
}
示例8: __construct
public function __construct($mbox, $domain, $user = null)
{
$this->mbox = $mbox;
$this->domain = $domain;
$this->address = "{$mbox}@{$domain}";
if (is_null($user)) {
$user = S::user();
}
$this->mmclient = new MMList($user, $this->domain);
}
示例9: handler_ajax_todo_clear
function handler_ajax_todo_clear($page)
{
S::assert_xsrf_token();
XDB::execute('DELETE FROM todo
WHERE uid = {?} AND checked = 1', S::user()->id());
if (XDB::affectedRows() != 1) {
$page->jsonAssign('error', "Impossible de nettoyer la liste des tâches");
}
return PL_JSON;
}
示例10: save
public function save(ProfilePage $page, $field, $value)
{
$deletePrivate = S::user()->isMe($page->owner) || S::admin();
Phone::deletePhones($page->pid(), Phone::LINK_ADDRESS, null, $deletePrivate);
Address::deleteAddresses($page->pid(), Address::LINK_PROFILE, null, null, $deletePrivate);
AddressReq::purge_requests($page->pid(), 0, 0, Address::LINK_PROFILE);
Address::saveFromArray($value, $page->pid(), Address::LINK_PROFILE, null, $deletePrivate);
if (S::user()->isMe($page->owner) && count($value) > 1) {
Platal::page()->trigWarning('Attention, tu as plusieurs adresses sur ton profil. Pense à supprimer celles qui sont obsolètes.');
}
}
示例11: handler_chat
function handler_chat($page, $group = 'platal')
{
$page->assign('jabber_hruid', S::user()->login());
$page->assign('jabber_nick', S::user()->displayName());
$page->assign('jabber_cookie', $_SERVER['HTTP_COOKIE']);
if ($group) {
$page->assign('jabber_room', $group);
} else {
$page->assign('jabber_room', 'br');
}
$page->changeTpl('chat/chat.tpl');
}
示例12: defaultForEdit
public static function defaultForEdit($max_level = null)
{
if (!S::logged()) {
$vis = self::get(self::VIEW_NONE);
} else {
$vis = S::user()->editVisibility();
}
if ($max_level != null) {
return $vis->restrict($max_level);
} else {
return $vis;
}
}
示例13: handle_editor
protected function handle_editor()
{
if (isset($_FILES['userfile'])) {
$upload =& PlUpload::get($_FILES['userfile'], S::user()->login(), 'photo');
if (!$upload) {
$this->trigError('Une erreur est survenue lors du téléchargement du fichier.');
return false;
}
$this->read($upload);
return $this->valid;
}
return false;
}
示例14: run
public function run()
{
$date = new FrankizDateTime();
$date->setTime(0, 0);
$date_n = new FrankizDateTime();
date_add($date_n, date_interval_create_from_date_string('1 day'));
$date_n->setTime(0, 0);
$activities = new ActivityInstanceFilter(new PFC_AND(new PFC_Or(new AIFC_User(S::user(), 'restricted'), new AIFC_User(S::user(), 'everybody')), new AIFC_Period($date, $date_n)));
$c = $activities->get();
$c->select(ActivityInstanceSelect::all());
$c->order('hour_begin', false);
$this->assign('day', new FrankizDateTime());
$this->assign('date', date("Y-m-d"));
$this->assign('activities', $c);
}
示例15: smarty_function_origin_picker
function smarty_function_origin_picker($params, &$smarty)
{
$gf = new GroupFilter(new PFC_And(new PFC_Not(new GFC_Namespace(Group::NS_USER)), new GFC_User(S::user(), Rights::admin())), new GFO_Score());
$gs = $gf->get();
if ($params['not_only_admin']) {
$gfo = new GroupFilter(new PFC_And(new GFC_Namespace(array(Group::NS_BINET, Group::NS_FREE)), new GFC_User(S::user(), Rights::restricted())), new GFO_Score());
$gso = $gfo->get()->diff($gs);
$temp = new Collection();
$temp->merge($gs)->merge($gso);
$temp->select(GroupSelect::base());
$smarty->assign('not_admin', $gso);
} else {
$gs = $gf->get()->select(GroupSelect::base());
}
$smarty->assign($params['out'], $gs);
}