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


PHP Kernel::getUserInfoMatrix方法代码示例

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


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

示例1: _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;
 }
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:48,代码来源:getuserprofil.zone.php

示例2: doSend

 /**
  * Soumission du formulaire d'�criture d'un minimail (envoie le minimail)
  *
  * @author Christophe Beyer <cbeyer@cap-tic.fr>
  * @since 2005/10/18
  * @see getNewForm()
  * @param string $dest Logins du(des) destinataire(s)
  * @param string $title Titre du minimail
  * @param string $message Corps du minimail
  * @param string $go Forme de soumission : preview (pr�visualiser) ou send (enregistrer)
  */
 public function doSend()
 {
     $dest = _request("dest") ? _request("dest") : "";
     $title = _request("title") ? _request("title") : "";
     $message = _request("message") ? _request("message") : "";
     $format = _request("format") ? _request("format") : "";
     $go = _request("go") ? _request("go") : 'preview';
     $iReply = CopixRequest::getInt('reply');
     $iForward = CopixRequest::getInt('forward');
     $destTxt = $dest;
     $destTxt = str_replace(array(" "), "", $destTxt);
     $destTxt = str_replace(array(",", ";"), ",", $destTxt);
     $destin = array_unique(explode(",", $destTxt));
     $fromId = _currentUser()->getId();
     $errors = array();
     if (!$dest) {
         $errors[] = CopixI18N::get('minimail.error.typeDest');
     }
     if (!$title) {
         $errors[] = CopixI18N::get('minimail.error.typeTitle');
     }
     if (!$message) {
         $errors[] = CopixI18N::get('minimail.error.typeMessage');
     }
     if (!$format) {
         $errors[] = CopixI18N::get('minimail.error.typeFormat');
     }
     $tabDest = array();
     // On v�rifie que les destinataires existent
     while (list(, $login) = each($destin)) {
         if (!$login) {
             continue;
         }
         $userInfo = Kernel::getUserInfo("LOGIN", $login, array('strict' => true));
         //print_r("login=$login");
         //print_r($userInfo);
         if (!$userInfo) {
             $errors[] = CopixI18N::get('minimail.error.badDest', array($login));
         } elseif ($userInfo["user_id"] == $fromId) {
             $errors[] = CopixI18N::get('minimail.error.writeHimself');
         } else {
             $droits = Kernel::getUserInfoMatrix($userInfo);
             if ($droits['communiquer']) {
                 $tabDest[$userInfo["user_id"]] = $userInfo["user_id"];
             } else {
                 $errors[] = CopixI18N::get('minimail.error.cannotWrite', array($login));
             }
         }
     }
     // On v�rifie les pi�ces jointes
     CopixConfig::get('minimail|attachment_size');
     //print_r($_FILES);
     for ($i = 1; $i <= 3; $i++) {
         if (isset($_FILES['attachment' . $i]) && !is_uploaded_file($_FILES['attachment' . $i]['tmp_name'])) {
             switch ($_FILES['attachment' . $i]['error']) {
                 case 0:
                     //no error; possible file attack!
                     $errors[] = CopixI18N::get('minimail|minimail.error.upload_default', $i);
                     break;
                 case 1:
                     //uploaded file exceeds the upload_max_filesize directive in php.ini
                     $errors[] = CopixI18N::get('minimail|minimail.error.upload_toobig', $i);
                     break;
                 case 2:
                     //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form
                     $errors[] = CopixI18N::get('minimail|minimail.error.upload_toobig', $i);
                     break;
                 case 3:
                     //uploaded file was only partially uploaded
                     $errors[] = CopixI18N::get('minimail|minimail.error.upload_partial', $i);
                     break;
                 case 4:
                     //no file was uploaded
                     break;
                 default:
                     $errors[] = CopixI18N::get('minimail|minimail.error.upload_default', $i);
                     break;
             }
         }
     }
     if (!$errors) {
         if (!$errors && $go == 'save') {
             $serv = CopixClassesFactory::create("MinimailService");
             $send = $serv->sendMinimail($title, $message, $fromId, $tabDest, $format);
             if (!$send) {
                 $errors[] = CopixI18N::get('minimail.error.send');
             }
         }
         if (!$errors && $go == 'save') {
//.........这里部分代码省略.........
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:101,代码来源:minimail.actiongroup.php


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