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


PHP GO::user方法代码示例

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


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

示例1: getHomeFolder

 /**
  * 
  * @param \GO\Base\Model\User $user
  * @return Folder
  */
 protected static function getHomeFolder(\GO\Base\Model\User $user = null)
 {
     if (!isset($user)) {
         $user = \GO::user();
     }
     return Folder::model()->findByPath('users/' . $user->username . DropboxModule::GO_ROOT, true);
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:12,代码来源:Sync.php

示例2: actionSelectedStore

 /**
  * The client CAN use the information contained in
  * $response['manage_permission'] to make decisions such as whether or not to
  * allow the current user to edit the set of groups in the store.
  * @param Array $params Client input parameters
  * @return $response for the client. 
  */
 protected function actionSelectedStore($params)
 {
     $currentPermissionLevel = \GO\Base\Model\Acl::getUserPermissionLevel($params['model_id'], \GO::user()->id);
     $response['manage_permission'] = $params['currentUserHasManagePermission'] = \GO\Base\Model\Acl::hasPermission($currentPermissionLevel, \GO\Base\Model\Acl::MANAGE_PERMISSION);
     $response = array_merge($response, parent::actionSelectedStore($params));
     return $response;
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:14,代码来源:AclGroupController.php

示例3: run

 /**
  * The code that needs to be called when the cron is running
  * 
  * If $this->enableUserAndGroupSupport() returns TRUE then the run function 
  * will be called for each $user. (The $user parameter will be given)
  * 
  * If $this->enableUserAndGroupSupport() returns FALSE then the 
  * $user parameter is null and the run function will be called only once.
  * 
  * @param CronJob $cronJob
  * @param \GO\Base\Model\User $user [OPTIONAL]
  */
 public function run(CronJob $cronJob, \GO\Base\Model\User $user = null)
 {
     \GO::session()->runAsRoot();
     $usersStmt = \GO\Base\Model\User::model()->findByAttribute('mail_reminders', 1);
     while ($userModel = $usersStmt->fetch()) {
         \GO::debug("Sending mail reminders to " . $userModel->username);
         $remindersStmt = \GO\Base\Model\Reminder::model()->find(\GO\Base\Db\FindParams::newInstance()->joinModel(array('model' => 'GO\\Base\\Model\\ReminderUser', 'localTableAlias' => 't', 'localField' => 'id', 'foreignField' => 'reminder_id', 'tableAlias' => 'ru'))->criteria(\GO\Base\Db\FindCriteria::newInstance()->addCondition('user_id', $userModel->id, '=', 'ru')->addCondition('time', time(), '<', 'ru')->addCondition('mail_sent', '0', '=', 'ru')));
         while ($reminderModel = $remindersStmt->fetch()) {
             //					$relatedModel = $reminderModel->getRelatedModel();
             //					var_dump($relatedModel->name);
             //					$modelName = $relatedModel ? $relatedModel->localizedName : \GO::t('unknown');
             $subject = \GO::t('reminder') . ': ' . $reminderModel->name;
             $time = !empty($reminderModel->vtime) ? $reminderModel->vtime : $reminderModel->time;
             date_default_timezone_set($userModel->timezone);
             $body = \GO::t('time') . ': ' . date($userModel->completeDateFormat . ' ' . $userModel->time_format, $time) . "\n";
             $body .= \GO::t('name') . ': ' . str_replace('<br />', ',', $reminderModel->name) . "\n";
             //					date_default_timezone_set(\GO::user()->timezone);
             $message = \GO\Base\Mail\Message::newInstance($subject, $body);
             $message->addFrom(\GO::config()->noreply_email, \GO::config()->title);
             $message->addTo($userModel->email, $userModel->name);
             \GO\Base\Mail\Mailer::newGoInstance()->send($message, $failedRecipients);
             if (!empty($failedRecipients)) {
                 trigger_error("Reminder mail failed for recipient: " . implode(',', $failedRecipients), E_USER_NOTICE);
             }
             $reminderUserModelSend = \GO\Base\Model\ReminderUser::model()->findSingleByAttributes(array('user_id' => $userModel->id, 'reminder_id' => $reminderModel->id));
             $reminderUserModelSend->mail_sent = 1;
             $reminderUserModelSend->save();
         }
         date_default_timezone_set(\GO::user()->timezone);
     }
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:43,代码来源:EmailReminders.php

示例4: actionBirthdays

 /**
  * Get the data for the grid that shows all the tasks from the selected tasklists.
  * 
  * @param Array $params
  * @return Array The array with the data for the grid. 
  */
 protected function actionBirthdays($params)
 {
     $today = mktime(0, 0, 0);
     $next_month = \GO\Base\Util\Date::date_add(mktime(0, 0, 0), 30);
     //\GO::debug($yesterday);
     $start = date('Y-m-d', $today);
     $end = date('Y-m-d', $next_month);
     //\GO::debug($start);
     $select = "t.id, birthday, first_name, middle_name, last_name, addressbook_id, photo, " . "IF (STR_TO_DATE(CONCAT(YEAR('{$start}'),'/',MONTH(birthday),'/',DAY(birthday)),'%Y/%c/%e') >= '{$start}', " . "STR_TO_DATE(CONCAT(YEAR('{$start}'),'/',MONTH(birthday),'/',DAY(birthday)),'%Y/%c/%e') , " . "STR_TO_DATE(CONCAT(YEAR('{$start}')+1,'/',MONTH(birthday),'/',DAY(birthday)),'%Y/%c/%e')) " . "as upcoming ";
     $findCriteria = \GO\Base\Db\FindCriteria::newInstance()->addCondition('birthday', '0000-00-00', '!=')->addRawCondition('birthday', 'NULL', 'IS NOT');
     $settings = \GO\Addressbook\Model\BirthdaysPortletSetting::model()->findByAttribute('user_id', \GO::user()->id);
     if (count($settings)) {
         $abooks = array_map(function ($value) {
             return $value->addressbook_id;
         }, $settings->fetchAll());
         $findCriteria->addInCondition('addressbook_id', $abooks);
     }
     $having = "upcoming BETWEEN '{$start}' AND '{$end}'";
     $findParams = \GO\Base\Db\FindParams::newInstance()->distinct()->select($select)->criteria($findCriteria)->having($having)->order('upcoming');
     //$response['data']['original_photo_url']=$model->photoURL;
     $columnModel = new \GO\Base\Data\ColumnModel('GO\\Addressbook\\Model\\Contact');
     $columnModel->formatColumn('addressbook_id', '$model->addressbook->name');
     $columnModel->formatColumn('photo_url', '$model->getPhotoThumbURL()');
     $columnModel->formatColumn('age', '($model->upcoming != date("Y-m-d")) ? $model->age+1 : $model->age');
     $store = new \GO\Base\Data\DbStore('GO\\Addressbook\\Model\\Contact', $columnModel, $_POST, $findParams);
     return $store->getData();
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:33,代码来源:PortletController.php

示例5: _write

 private function _write($data)
 {
     if (!isset($this->_fp)) {
         $this->_fp = fopen('php://output', 'w+');
     }
     fputcsv($this->_fp, $data, \GO::user()->list_separator, \GO::user()->text_separator);
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:7,代码来源:ExportCSV.php

示例6: formatStoreRecord

 public function formatStoreRecord($record, $model, $store)
 {
     $r = new \GO\Base\Mail\EmailRecipients();
     $r->addRecipient($model->email, $model->name);
     $record['from'] = (string) $r;
     $record['html_signature'] = \GO\Base\Util\String::text_to_html($model->signature);
     $record['plain_signature'] = $model->signature;
     $record['signature_below_reply'] = $model->account->signature_below_reply;
     $record['template_id'] = 0;
     if (\GO::modules()->addressbook) {
         $defaultAccountTemplateModel = \GO\Addressbook\Model\DefaultTemplateForAccount::model()->findByPk($model->account_id);
         if ($defaultAccountTemplateModel) {
             $record['template_id'] = $defaultAccountTemplateModel->template_id;
         } else {
             $defaultUserTemplateModel = \GO\Addressbook\Model\DefaultTemplate::model()->findByPk(\GO::user()->id);
             if (!$defaultUserTemplateModel) {
                 $defaultUserTemplateModel = new \GO\Addressbook\Model\DefaultTemplateForAccount();
                 $defaultUserTemplateModel->account_id = $model->account_id;
                 $defaultUserTemplateModel->save();
             }
             $record['template_id'] = $defaultUserTemplateModel->template_id;
         }
     }
     unset($record['signature']);
     return parent::formatStoreRecord($record, $model, $store);
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:26,代码来源:AliasController.php

示例7: init

 public function init()
 {
     $this->formModel = new \GO\Site\Widget\ContactForm\ContactForm();
     $this->formModel->receipt = isset($this->receipt) ? $this->receipt : \GO::config()->webmaster_email;
     $this->formModel->name = \GO::user() ? \GO::user()->name : 'Website Guest';
     $this->form = new \GO\Site\Widget\Form();
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:7,代码来源:Widget.php

示例8: head

 public static function head()
 {
     $font_size = \GO::user() ? \GO::config()->get_setting('email_font_size', \GO::user()->id) : false;
     if (!$font_size) {
         $font_size = '12px';
     }
     echo "\n<!-- Inserted by EmailModule::head() -->\n<style>\n" . '.message-body,.message-body p, .message-body li, .go-html-formatted td, .em-composer .em-plaintext-body-field{' . 'font-size: ' . $font_size . ';!important' . "}\n</style>\n<!-- End EmailModule::head() -->\n";
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:8,代码来源:EmailModule.php

示例9: checkWritePermission

 public function checkWritePermission($delete = false)
 {
     $fsFile = new \GO\Base\Fs\File($this->path);
     $this->folder = \GO\Files\Model\Folder::model()->findByPath($fsFile->parent()->stripFileStoragePath());
     if (!\GO\Base\Model\Acl::hasPermission($this->folder->getPermissionLevel(), \GO\Base\Model\Acl::WRITE_PERMISSION)) {
         throw new Sabre\DAV\Exception\Forbidden("DAV: User " . \GO::user()->username . " doesn't have write permission for file '" . $this->relpath . '"');
     }
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:8,代码来源:File.php

示例10: defaultAttributes

 public function defaultAttributes()
 {
     $attr = parent::defaultAttributes();
     $attr['modified_user_id'] = \GO::user()->id;
     $attr['mtime'] = time();
     $attr['status'] = 0;
     return $attr;
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:8,代码来源:FolderNotificationMessage.php

示例11: actionDisplay

 protected function actionDisplay($params)
 {
     $findParams = \GO\Base\Db\FindParams::newInstance()->select('count(*) AS count')->join(\GO\Base\Model\ReminderUser::model()->tableName(), \GO\Base\Db\FindCriteria::newInstance()->addModel(\GO\Base\Model\Reminder::model())->addCondition('id', 'ru.reminder_id', '=', 't', true, true), 'ru')->criteria(\GO\Base\Db\FindCriteria::newInstance()->addModel(\GO\Base\Model\ReminderUser::model(), 'ru')->addCondition('user_id', \GO::user()->id, '=', 'ru')->addCondition('time', time(), '<', 'ru'));
     $model = \GO\Base\Model\Reminder::model()->findSingle($findParams);
     $html = "";
     $this->fireEvent('reminderdisplay', array($this, &$html, $params));
     $this->render("Reminder", array('count' => intval($model->count), 'html' => $html));
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:8,代码来源:ReminderController.php

示例12: __construct

 public function __construct($filename)
 {
     if (\GO::user()) {
         $this->delimiter = \GO::user()->list_separator;
         $this->enclosure = \GO::user()->text_separator;
     }
     $this->filename = $filename;
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:8,代码来源:Reader.php

示例13: getPrincipalsByPrefix

 /**
  * Returns a list of principals based on a prefix.
  *
  * This prefix will often contain something like 'principals'. You are only 
  * expected to return principals that are in this base path.
  *
  * You are expected to return at least a 'uri' for every user, you can 
  * return any additional properties if you wish so. Common properties are:
  *   {DAV:}displayname 
  *   {http://sabredav.org/ns}email-address - This is a custom SabreDAV 
  *     field that's actualy injected in a number of other properties. If
  *     you have an email address, use this property.
  * 
  * @param string $prefixPath 
  * @return array 
  */
 public function getPrincipalsByPrefix($prefixPath)
 {
     \GO::debug('GO\\DAV\\Auth\\Backend::getUsers()');
     if (!isset($this->users)) {
         $this->users = array($this->_modelToDAVUser(\GO::user()));
     }
     return $this->users;
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:24,代码来源:PrincipalBackend.php

示例14: beforeSubmit

 protected function beforeSubmit(&$response, &$model, &$params)
 {
     if (!\GO::user()) {
         if (empty($params['serverclient_token']) || $params['serverclient_token'] != \GO::config()->serverclient_token) {
             throw new \GO\Base\Exception\AccessDenied();
         } else {
             \GO::session()->runAsRoot();
         }
     }
     if (isset($params['domain_id'])) {
         $domainModel = \GO\Postfixadmin\Model\Domain::model()->findByPk($params['domain_id']);
     } else {
         $domainModel = \GO\Postfixadmin\Model\Domain::model()->findSingleByAttribute("domain", $params['domain']);
         //serverclient module doesn't know the domain_id. It sends the domain name as string.
         if (!$domainModel) {
             //todo create new domain
             $domainModel = new \GO\Postfixadmin\Model\Domain();
             $domainModel->domain = $params['domain'];
             $domainModel->user_id = \GO::user()->id;
             $domainModel->save();
         }
         $params['domain_id'] = $domainModel->id;
         $model->quota = $domainModel->default_quota;
     }
     if (isset($params['quota'])) {
         $model->quota = \GO\Base\Util\Number::unlocalize($params['quota']) * 1024;
         unset($params['quota']);
     }
     if ($params['password'] != $params['password2']) {
         throw new \Exception(\GO::t('passwordMatchError'));
     }
     if (empty($params['password'])) {
         unset($params['password']);
     }
     if (isset($params['username'])) {
         $params['username'] .= '@' . $domainModel->domain;
     }
     if ($model->isNew) {
         //			$aliasModel = \GO\Postfixadmin\Model\Alias::model()->findSingleByAttribute('address', $params['username']);
         //			if (empty($aliasModel)) {
         //				$aliasModel = new \GO\Postfixadmin\Model\Alias();
         //			}
         //			$aliasModel->domain_id = $params['domain_id'];
         //			$aliasModel->address = $params['username'];
         //			$aliasModel->goto = $params['username'];
         //			$aliasModel->save();
         if (!empty($params['alias']) && $params['alias'] != $params['username']) {
             $aliasModel = \GO\Postfixadmin\Model\Alias::model()->findSingleByAttribute('address', $params['alias']);
             if (empty($aliasModel)) {
                 $aliasModel = new \GO\Postfixadmin\Model\Alias();
             }
             $aliasModel->domain_id = $params['domain_id'];
             $aliasModel->address = $params['alias'];
             $aliasModel->goto = $params['username'];
             $aliasModel->save();
         }
     }
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:58,代码来源:MailboxController.php

示例15: beforeSave

 protected function beforeSave()
 {
     $folderModel = Folder::model()->findByPk($this->folder_id);
     $existingBookmarkModel = Bookmark::model()->findSingleByAttributes(array('user_id' => \GO::user()->id, 'folder_id' => $folderModel->id));
     if (!empty($existingBookmarkModel)) {
         throw new \Exception(str_replace('%fn', $folderModel->name, \GO::t('bookmarkAlreadyExists', 'files')));
     }
     return parent::beforeSave();
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:9,代码来源:Bookmark.php


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