/** * * @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); }
/** * 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; }
/** * 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); } }
/** * 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(); }
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); }
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); }
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(); }
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"; }
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 . '"'); } }
public function defaultAttributes() { $attr = parent::defaultAttributes(); $attr['modified_user_id'] = \GO::user()->id; $attr['mtime'] = time(); $attr['status'] = 0; return $attr; }
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)); }
public function __construct($filename) { if (\GO::user()) { $this->delimiter = \GO::user()->list_separator; $this->enclosure = \GO::user()->text_separator; } $this->filename = $filename; }
/** * 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; }
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(); } } }
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(); }
/** * Get the name of the theme that is selected by the user. * * @return string */ public function getName() { $theme = \GO::config()->allow_themes && \GO::user() ? \GO::user()->theme : \GO::config()->theme; if (!file_exists(\GO::view()->getPath() . 'themes/' . $theme . '/Layout.php')) { return 'Default'; } else { return $theme; } }
protected function getModelFromParams($params) { $model = \GO\Summary\Model\Note::model()->findByPk(\GO::user()->id); if (!$model) { $model = new \GO\Summary\Model\Note(); $model->save(); } return $model; }
public static function loadReadMore() { $readMore = \GO::config()->get_setting("comments_enable_read_more", \GO::user()->id); if ($readMore === false) { return 1; } else { return $readMore; } }
/** * Get the amount is diskspace used when exciding quota * Depending on the quota that is reached * @return integer Disk uage in bytes */ protected function getUsage() { if (\GO::config()->quota < $this->getTotalUsage() && \GO::config()->quota > 0) { return $this->getTotalUsage(); } if (\GO::user() && \GO::user()->disk_usage) { return \GO::user()->disk_usage; } return $this->getTotalUsage(); }
/** * Get the temporary files folder or obitonally a subfolder of it. * * @var string $sub Optionally create a sub folder * @return Folder */ public static function tempFolder($sub = '') { $path = \GO::config()->orig_tmpdir . \GO::user()->id; if (!empty($sub)) { $path .= '/' . $sub; } $folder = new Folder($path); $folder->create(); return $folder; }
protected function actionRenderJupload($params) { //$cookieParams = session_get_cookie_params(); $sessionCookie = 'Cookie: ' . session_name() . '=' . session_id(); //TODO: Check if code below is necessary // if(!empty($cookieParams['domain'])) // $sessionCookie .= '; Domain='.$cookieParams['domain']; // // $sessionCookie .= '; Path='.$cookieParams['path']; // // if(!empty($cookieParams['lifetime'])) // $sessionCookie .= '; Expires='.gmdate('D, d M Y H:i:s \G\M\T', time()+$cookieParams['lifetime']); // // if($cookieParams['secure']) // $sessionCookie .= '; Secure'; // // if($cookieParams['httponly']) // $sessionCookie .= '; HttpOnly'; $afterUploadScript = ' <script type="text/javascript"> function afterUpload(success){ // opener.GO.files.juploadFileBrowser.sendOverwrite({upload:true}); if(success){ window.uploadSuccess=true; setTimeout("self.close();", 1000); } } </script> '; $appletCode = ' <applet code="wjhk.jupload2.JUploadApplet" name="JUpload" archive="' . \GO::config()->host . 'go/vendor/jupload/wjhk.jupload.jar' . '" width="640" height="480" mayscript="true" alt="The java pugin must be installed."> <param name="lang" value="' . \GO::user()->language . '" /> <param name="readCookieFromNavigator" value="false" /> <!--<param name="lookAndFeel" value="system" />--> <param name="postURL" value="' . \GO::url('files/jupload/handleUploads') . '" /> <param name="afterUploadURL" value="javascript:afterUpload(%success%);" /> <param name="showLogWindow" value="false" /> <param name="maxChunkSize" value="1048576" /> <param name="specificHeaders" value="' . $sessionCookie . '" /> <param name="maxFileSize" value="' . intval(\GO::config()->max_file_size) . '" /> <param name="nbFilesPerRequest" value="5" /> <!--<param name="debugLevel" value="99" />--> Java 1.5 or higher plugin required. </applet>'; $this->render('jupload', array('applet' => $appletCode, 'afterUploadScript' => $afterUploadScript)); }
protected function actionRedirect() { $tmpFile = \GO\Base\Fs\File::tempFile(); $tmpFile->putContents(\GO::user()->id); if (empty(\GO::config()->phpbb3_url)) { throw new \Exception('You must configure phpbb3_url in your config.php file'); } $url = \GO::config()->phpbb3_url . '?goauth=' . base64_encode($tmpFile->path()) . '&sid=' . md5(uniqid(time())); header('Location: ' . $url); exit; }
public function __construct() { $f = new \GO\Base\Fs\Folder(\GO::config()->file_storage_path . 'cache'); $f->create(); $this->_cacheFile = \GO::config()->file_storage_path . 'cache/script-'; if (\GO::user()) { $this->_cacheFile .= \GO::user()->username; } else { $this->_cacheFile .= "loggedoff"; } $this->_cacheFile .= '.js'; }
protected function actionEnableStore($params) { $columnModel = new \GO\Base\Data\ColumnModel(\GO\Customfields\Model\Block::model()); $columnModel->formatColumn('col_id', '"col_".$model->customField->id', array(), 'field_id'); $columnModel->formatColumn('customfield_name', '$model->customField->name', array(), 'field_id'); $columnModel->formatColumn('customfield_datatype', '$model->customField->datatype', array(), 'field_id'); $columnModel->formatColumn('extends_model', '$model->customField->category->extends_model', array(), 'field_id'); $columnModel->formatColumn('enabled', '!empty($model->enabled_block_id)', array(), 'enabled_block_id'); $findParams = \GO\Base\Db\FindParams::newInstance()->select('t.*,eb.block_id AS enabled_block_id')->joinModel(array('model' => 'GO\\Customfields\\Model\\EnabledBlock', 'localTableAlias' => 't', 'localField' => 'id', 'foreignField' => 'block_id', 'tableAlias' => 'eb', 'type' => 'LEFT', 'criteria' => \GO\Base\Db\FindCriteria::newInstance()->addCondition('model_type_name', $params['model_name'], '=', 'eb')->addCondition('model_id', $params['model_id'], '=', 'eb')))->joinModel(array('model' => 'GO\\Customfields\\Model\\Field', 'localTableAlias' => 't', 'localField' => 'field_id', 'foreignField' => 'id', 'tableAlias' => 'cf', 'type' => 'INNER'))->joinModel(array('model' => 'GO\\Customfields\\Model\\Category', 'localTableAlias' => 'cf', 'localField' => 'category_id', 'foreignField' => 'id', 'tableAlias' => 'cfcat', 'type' => 'INNER'))->join('go_acl', \GO\Base\Db\FindCriteria::newInstance()->addRawCondition('a.acl_id', 'cfcat.acl_id'), 'a')->join('go_users_groups', \GO\Base\Db\FindCriteria::newInstance()->addRawCondition('a.group_id', 'ug.group_id'), 'ug', 'LEFT')->criteria(\GO\Base\Db\FindCriteria::newInstance()->addCondition('user_id', \GO::user()->id, '=', 'a', false)->addCondition('user_id', \GO::user()->id, '=', 'ug', false)); $store = new \GO\Base\Data\DbStore('GO\\Customfields\\Model\\Block', $columnModel, $params, $findParams); echo $this->renderStore($store); }
public function formatColumns(\GO\Base\Data\ColumnModel $columnModel) { $sortAlias = \GO::user()->sort_name == "first_name" ? array('first_name', 'last_name') : array('last_name', 'first_name'); $columnModel->formatColumn('name', '$model->getName(\\GO::user()->sort_name)', array(), $sortAlias, \GO::t('strName')); $columnModel->formatColumn('company_name', '$model->company_name', array(), '', \GO::t('company', 'addressbook')); $columnModel->formatColumn('ab_name', '$model->ab_name', array(), '', \GO::t('addressbook', 'addressbook')); $columnModel->formatColumn('age', '$model->age', array(), 'birthday'); $columnModel->formatColumn('action_date', '$model->getActionDate()', array(), 'action_date'); $columnModel->formatColumn('cf', '$model->id.":".$model->name'); //special field used by custom fields. They need an id an value in one.) return parent::formatColumns($columnModel); }
/** * Creates a new component. * * By default this object will iterate over its own children, but this can * be overridden with the iterator argument * * @param string $name * @param Sabre\VObject\ElementList $iterator */ public function __construct() { parent::__construct(); $tz = new \DateTimeZone(\GO::user() ? \GO::user()->timezone : date_default_timezone_get()); //$tz = new \DateTimeZone("Europe/Amsterdam"); $transitions = $tz->getTransitions(); $start_of_year = mktime(0, 0, 0, 1, 1); $to = \GO\Base\Util\Date::get_timezone_offset(time()); if ($to < 0) { if (strlen($to) == 2) { $to = '-0' . $to * -1; } } else { if (strlen($to) == 1) { $to = '0' . $to; } $to = '+' . $to; } $STANDARD_TZOFFSETFROM = $STANDARD_TZOFFSETTO = $DAYLIGHT_TZOFFSETFROM = $DAYLIGHT_TZOFFSETTO = $to; $STANDARD_RRULE = ''; $DAYLIGHT_RRULE = ''; for ($i = 0, $max = count($transitions); $i < $max; $i++) { if ($transitions[$i]['ts'] > $start_of_year) { $weekday1 = $this->_getDay($transitions[$i]['time']); $weekday2 = $this->_getDay($transitions[$i + 1]['time']); if ($transitions[$i]['isdst']) { $dst_start = $transitions[$i]; $dst_end = $transitions[$i + 1]; } else { $dst_end = $transitions[$i]; $dst_start = $transitions[$i + 1]; } $STANDARD_TZOFFSETFROM = $this->_formatVtimezoneTransitionHour($dst_start['offset'] / 3600); $STANDARD_TZOFFSETTO = $this->_formatVtimezoneTransitionHour($dst_end['offset'] / 3600); $DAYLIGHT_TZOFFSETFROM = $this->_formatVtimezoneTransitionHour($dst_end['offset'] / 3600); $DAYLIGHT_TZOFFSETTO = $this->_formatVtimezoneTransitionHour($dst_start['offset'] / 3600); $DAYLIGHT_RRULE = "FREQ=YEARLY;BYDAY={$weekday1};BYMONTH=" . date('n', $dst_start['ts']); $STANDARD_RRULE = "FREQ=YEARLY;BYDAY={$weekday2};BYMONTH=" . date('n', $dst_end['ts']); break; } } $this->tzid = $tz->getName(); // $this->add("last-modified", "19870101T000000Z"); $rrule = new \Sabre\VObject\Recur\RRuleIterator($STANDARD_RRULE, new \DateTime('1970-01-01 ' . substr($STANDARD_TZOFFSETFROM, 1) . ':00')); $rrule->next(); $rrule->next(); $this->add($this->createComponent("standard", array('dtstart' => $rrule->current()->format('Ymd\\THis'), 'rrule' => $STANDARD_RRULE, 'tzoffsetfrom' => $STANDARD_TZOFFSETFROM . "00", 'tzoffsetto' => $STANDARD_TZOFFSETTO . "00"))); $rrule = new \Sabre\VObject\Recur\RRuleIterator($DAYLIGHT_RRULE, new \DateTime('1970-01-01 ' . substr($DAYLIGHT_TZOFFSETFROM, 1) . ':00')); $rrule->next(); $rrule->next(); $this->add($this->createComponent("daylight", array('dtstart' => $rrule->current()->format('Ymd\\THis'), 'rrule' => $DAYLIGHT_RRULE, 'tzoffsetfrom' => $DAYLIGHT_TZOFFSETFROM . "00", 'tzoffsetto' => $DAYLIGHT_TZOFFSETTO . "00"))); }
public function defaultAttributes() { $attr = parent::defaultAttributes(); if (PHP_SAPI == 'cli') { $attr['user_agent'] = 'cli'; } else { $attr['user_agent'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'unknown'; } $attr['ip'] = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''; $attr['controller_route'] = \GO::router()->getControllerRoute(); $attr['username'] = \GO::user() ? \GO::user()->username : '******'; return $attr; }
private function _setCSV($mode) { if (!isset($this->delimiter)) { $this->delimiter = \GO::user() ? \GO::user()->list_separator : ','; } if (!isset($this->enclosure)) { $this->enclosure = \GO::user() ? \GO::user()->text_separator : '"'; } if (!isset($this->_csv)) { $this->_csv = new \GO\Base\Csv\Writer($this->path()); $this->_csv->delimiter = $this->delimiter; $this->_csv->enclosure = $this->enclosure; } }
protected function actionAddressbookStore() { $colModel = new \GO\Base\Data\ColumnModel(\GO\Addressbook\Model\Addressbook::model()); // $colModel->formatColumn('type', '$model->customfieldtype->name()'); $findParams = new \GO\Base\Db\FindParams(); $findParams->ignoreAcl(); $findParams->getCriteria()->addCondition('user_id', \GO::user()->id, '=', 'f'); $findParams->order('name'); $findParams->joinModel(array('model' => 'GO\\Favorites\\Model\\Addressbook', 'localTableAlias' => 't', 'localField' => 'id', 'foreignField' => 'addressbook_id', 'tableAlias' => 'f', 'type' => 'INNER')); $store = new \GO\Base\Data\DbStore('GO\\Addressbook\\Model\\Addressbook', $colModel, $_POST, $findParams); $store->multiSelectable('books'); // $store->defaultSort = array('sort','name'); echo $this->renderStore($store); }
public function init() { if (isset($_GET[$this->pageParam])) { $this->currentPage = $_GET[$this->pageParam]; } if (empty($this->pageSize)) { $this->pageSize = \GO::user() ? \GO::user()->max_rows_list : \GO::config()->nav_page_size; } if (!$this->store instanceof \GO\Base\Data\DbStore) { throw new \Exception('store needs to be an instance of \\GO\\Base\\Data\\Store'); } $this->store->start = $this->pageSize * ($this->currentPage - 1); $this->store->limit = $this->pageSize; }