本文整理汇总了PHP中GO类的典型用法代码示例。如果您正苦于以下问题:PHP GO类的具体用法?PHP GO怎么用?PHP GO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GO类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: afterDelete
protected function afterDelete()
{
if (\GO::modules()->isInstalled('log')) {
Log::create(Log::ACTION_DELETE, 'Removed ' . $this->contact->name . ' from addresslist ' . $this->addresslist->name, $this->className(), $this->contact_id . ':' . $this->addresslist_id);
}
return parent::afterDelete();
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:7,代码来源:AddresslistContact.php
示例2: isAvailable
public function isAvailable()
{
if (!\GO::scriptCanBeDecoded($this->package())) {
return false;
} else {
return true;
}
// if we can run this file without ioncube it must be open source.
// if(!function_exists('ioncube_file_is_encoded') || !ioncube_file_is_encoded()){
// return true;
// }
/*if(!GO::user()){
return true;
}
$className = get_class($this);
$classParts = explode('\\', $className);
if(!License::userHasModule(GO::user()->username, strtolower($classParts[1]))){
return false;
}
return true;*/
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:27,代码来源:Module.php
示例3: 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
示例4: actionGetUsers
/**
* Retreive all users that belong to the given group.
*
* @param int $id
* @return array Users
*/
protected function actionGetUsers($params)
{
//don't check ACL here because this method may be called by anyone.
$group = \GO\Base\Model\Group::model()->findByPk($params['id'], false, true);
if (empty($group)) {
$group = new \GO\Base\Model\Group();
}
if (isset($params['add_users']) && !empty($group->id)) {
$users = json_decode($params['add_users']);
foreach ($users as $usr_id) {
if ($group->addUser($usr_id)) {
\GO\Base\Model\User::model()->findByPk($usr_id)->checkDefaultModels();
}
}
}
$store = \GO\Base\Data\Store::newInstance(\GO\Base\Model\User::model());
$store->getColumnModel()->formatColumn('name', '$model->name', array(), array('first_name', 'last_name'));
$storeParams = $store->getDefaultParams($params)->joinCustomFields(false);
$delresponse = array();
//manually check permission here because this method may be accessed by any logged in user. allowWithoutModuleAccess is used above.
if ($group->checkPermissionLevel(\GO\Base\Model\Acl::DELETE_PERMISSION)) {
// The users in the group "everyone" cannot be deleted
if ($group->id != \GO::config()->group_everyone) {
$store->processDeleteActions($params, 'GO\\Base\\Model\\UserGroup', array('group_id' => $group->id));
} else {
$delresponse['deleteSuccess'] = false;
$delresponse['deleteFeedback'] = 'Members of the group everyone cannot be deleted.';
}
}
$stmt = $group->users($storeParams);
$store->setStatement($stmt);
$response = $store->getData();
$response = array_merge($response, $delresponse);
return $response;
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:41,代码来源:GroupController.php
示例5: actionGroupsWithResources
protected function actionGroupsWithResources($params)
{
$stmt = \GO\Calendar\Model\Group::model()->find(\GO\Base\Db\FindParams::newInstance()->order('t.name')->criteria(\GO\Base\Db\FindCriteria::newInstance()->addCondition('id', 1, '>')));
$response['results'] = array();
$response['total'] = 0;
while ($group = $stmt->fetch()) {
$record = $group->getAttributes('formatted');
if (\GO::modules()->customfields) {
$record['customfields'] = \GO\Customfields\Controller\CategoryController::getEnabledCategoryData("GO\\Calendar\\Model\\Event", $group->id);
} else {
$record['customfields'] = array();
}
$record['resources'] = array();
$calStmt = \GO\Calendar\Model\Calendar::model()->find(\GO\Base\Db\FindParams::newInstance()->permissionLevel(\GO\Base\Model\Acl::READ_PERMISSION)->joinCustomFields()->order('t.name')->criteria(\GO\Base\Db\FindCriteria::newInstance()->addCondition('group_id', $group->id)));
while ($resource = $calStmt->fetch()) {
$resourceRecord = $resource->getAttributes('formatted');
$record['resources'][] = $resourceRecord;
}
$num_resources = count($record['resources']);
if ($num_resources > 0) {
$response['results'][] = $record;
$response['total'] += $num_resources;
}
}
return $response;
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:26,代码来源:GroupController.php
示例6: validateModel
public static function validateModel($model, $attrmapping = false)
{
// if(\GO\Base\Util\Http::isPostRequest()){
// if(!empty($attrmapping)){
// foreach($attrmapping as $attr=>$replaceattr){
// $model->$replaceattr = $_POST[$attr];
// }
// }
$errors = array();
if (!$model->validate()) {
$errors = $model->getValidationErrors();
}
if ($model->customfieldsRecord && !$model->customfieldsRecord->validate()) {
$errors = array_merge($errors, $model->customfieldsRecord->getValidationErrors());
}
if (count($errors)) {
foreach ($errors as $attribute => $message) {
$formAttribute = isset($attrmapping[$attribute]) ? $attrmapping[$attribute] : $attribute;
Input::setError($formAttribute, $message);
// replace is needed because of a mix up with order model and company model
}
Error::setError(\GO::t('errorsInForm'));
return false;
} else {
return true;
}
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:27,代码来源:Error.php
示例7: _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
示例8: checkIpAddress
public static function checkIpAddress(array &$params, array &$response)
{
$oldIgnoreAcl = \GO::setIgnoreAclPermissions();
$userModel = \GO\Base\Model\User::model()->findSingleByAttribute('username', $params['username']);
if (!$userModel) {
return true;
}
$allowedIpAddresses = array();
//"127.0.0.1");
$whitelistIpAddressesStmt = Model\IpAddress::model()->find(\GO\Base\Db\FindParams::newInstance()->select('t.ip_address')->joinModel(array('model' => 'GO\\Ipwhitelist\\Model\\EnableWhitelist', 'localTableAlias' => 't', 'localField' => 'group_id', 'foreignField' => 'group_id', 'tableAlias' => 'ew', 'type' => 'INNER'))->joinModel(array('model' => 'GO\\Base\\Model\\UserGroup', 'localTableAlias' => 'ew', 'localField' => 'group_id', 'foreignField' => 'group_id', 'tableAlias' => 'usergroup', 'type' => 'INNER'))->criteria(\GO\Base\Db\FindCriteria::newInstance()->addCondition('user_id', $userModel->id, '=', 'usergroup')));
if (!empty($whitelistIpAddressesStmt) && $whitelistIpAddressesStmt->rowCount() > 0) {
foreach ($whitelistIpAddressesStmt as $ipAddressModel) {
// $enabledWhitelistModel = Model\EnableWhitelist::model()->findByPk($groupModel->id);
// if (!empty($enabledWhitelistModel)) {
// $ipAddressesStmt = Model\IpAddress::model()->findByAttribute('group_id',$groupModel->id);
// foreach ($ipAddressesStmt as $ipAddressModel) {
if (!in_array($ipAddressModel->ip_address, $allowedIpAddresses)) {
$allowedIpAddresses[] = $ipAddressModel->ip_address;
}
// }
// }
}
}
\GO::setIgnoreAclPermissions($oldIgnoreAcl);
if (count($allowedIpAddresses) > 0 && !in_array($_SERVER['REMOTE_ADDR'], $allowedIpAddresses)) {
$response['feedback'] = sprintf(\GO::t('wrongLocation', 'ipwhitelist'), $_SERVER['REMOTE_ADDR']);
$response['success'] = false;
return false;
}
return true;
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:31,代码来源:IpwhitelistModule.php
示例9: getTotalUsage
/**
* Query the file_storage_usage once;
* @return integer total file storage usage in bytes
*/
protected function getTotalUsage()
{
if (!isset($this->_total_file_storage)) {
$this->_total_file_storage = \GO::config()->get_setting('file_storage_usage');
}
return $this->_total_file_storage;
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:11,代码来源:InsufficientDiskspace.php
示例10: printHead
function printHead()
{
echo '<html><head>' . '<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />' . '<link href="install.css" rel="stylesheet" type="text/css" />' . '<title>' . \GO::config()->product_name . ' Installation</title>' . '</head>' . '<body style="font-family: Arial,Helvetica;background-color:#f1f1f1">';
echo '<form method="post">';
echo '<div style="width:800px;padding:20px;margin:10px auto;background-color:white">';
echo '<img src="logo.gif" border="0" align="middle" style="margin:0px;margin-bottom:20px;" />';
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:7,代码来源:header.php
示例11: getPath
/**
* Get the path to the template folder
*
* @return string
*/
public function getPath()
{
if (empty(\Site::model()->module)) {
return false;
}
return \GO::config()->root_path . 'modules/' . \Site::model()->module . '/views/site/';
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:12,代码来源:Template.php
示例12: actionSave
protected function actionSave($params)
{
if (empty($params['number']) || empty($params['remind_date']) || empty($params['remind_time'])) {
throw new \Exception('Not all parameters are given');
}
$scheduleCall = new \GO\Tasks\Model\Task();
$scheduleCall->setAttributes($params);
// Check if the contact_id is really an ID or if it is a name. (The is_contact is true when it is an ID)
if (!empty($params['contact_id'])) {
$contact = \GO\Addressbook\Model\Contact::model()->findByPk($params['contact_id']);
if (!empty($params['number']) && !empty($params['save_as'])) {
$contact->{$params['save_as']} = $params['number'];
$contact->save();
}
$name = $contact->name;
} else {
$name = $params['contact_name'];
}
$scheduleCall->name = str_replace(array('{name}', '{number}'), array($name, $params['number']), \GO::t('scheduleCallTaskName', 'tasks'));
$scheduleCall->reminder = \GO\Base\Util\Date::to_unixtime($params['remind_date'] . ' ' . $params['remind_time']);
$scheduleCall->save();
if (isset($contact)) {
$scheduleCall->link($contact);
}
echo $this->renderSubmit($scheduleCall);
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:26,代码来源:ScheduleCallController.php
示例13: 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
示例14: actionSubmit
protected function actionSubmit($params)
{
$text = $params['login_screen_text'];
$reportFeedback = '';
if (preg_match("/^<br[^>]*>\$/", $text)) {
$text = "";
}
\GO::config()->save_setting('login_screen_text', $text);
\GO::config()->save_setting('login_screen_text_title', $_POST['login_screen_text_title']);
\GO::config()->save_setting('login_screen_text_enabled', !empty($_POST['login_screen_text_enabled']) ? '1' : '0');
if (!empty($params['addressbook_name_template'])) {
\GO\Base\Model\AbstractUserDefaultModel::setNameTemplate("GO\\Addressbook\\Model\\Addressbook", $params['addressbook_name_template']);
}
if (!empty($params['task_name_template'])) {
\GO\Base\Model\AbstractUserDefaultModel::setNameTemplate("GO\\Tasks\\Model\\Tasklist", $params['task_name_template']);
}
if (isset($params['GO\\Tasks\\Model\\Tasklist_change_all_names'])) {
$this->_updateAllDefaultTasklists($reportFeedback);
}
if (!empty($params['calendar_name_template'])) {
\GO\Base\Model\AbstractUserDefaultModel::setNameTemplate("GO\\Calendar\\Model\\Calendar", $params['calendar_name_template']);
}
if (isset($params['GO\\Calendar\\Model\\Calendar_change_all_names'])) {
$this->_updateAllDefaultCalendars($reportFeedback);
}
$response['feedback'] = !empty($reportFeedback) ? $reportFeedback : '';
$response['success'] = true;
return $response;
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:29,代码来源:SettingController.php
示例15: 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
示例16: 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
示例17: setAuthorized
/**
* Set an authorization for an action so the current session is authorized to
* process the action.
*
* @param string $name
*/
public static function setAuthorized($name)
{
if (empty(\GO::session()->values['Authorized'])) {
\GO::session()->values['Authorized'] = array();
}
\GO::session()->values['Authorized'][] = $name;
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:13,代码来源:Actions.php
示例18: __construct
public function __construct($mailbox, $imap)
{
// $imap->last_error(); // Get the last error
$message = sprintf(\GO::t('MailboxNotFoundException'), $mailbox);
$imap->clear_errors();
// Needed to clear the imap errors
parent::__construct($message);
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:8,代码来源:MailboxNotFound.php
示例19: 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
示例20: __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
注:本文中的GO类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论