本文整理汇总了PHP中GO::modules方法的典型用法代码示例。如果您正苦于以下问题:PHP GO::modules方法的具体用法?PHP GO::modules怎么用?PHP GO::modules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GO
的用法示例。
在下文中一共展示了GO::modules方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _addAccount
private static function _addAccount($user, $domainName)
{
if (\GO::modules()->isInstalled('email')) {
\GO::debug("SERVERCLIENT: Adding e-mail account for " . $user->username . '@' . $domainName);
$accountModel = new \GO\Email\Model\Account();
$accountModel->user_id = $user->id;
$accountModel->mbroot = \GO::config()->serverclient_mbroot;
$accountModel->use_ssl = \GO::config()->serverclient_use_ssl;
$accountModel->novalidate_cert = \GO::config()->serverclient_novalidate_cert;
// $accountModel->type=\GO::config()->serverclient_type;
$accountModel->host = \GO::config()->serverclient_host;
$accountModel->port = \GO::config()->serverclient_port;
// $accountModel->name=$user->name;
$accountModel->username = $user->username;
if (empty(\GO::config()->serverclient_dont_add_domain_to_imap_username)) {
$accountModel->username .= '@' . $domainName;
}
$accountModel->password = $user->getUnencryptedPassword();
$accountModel->smtp_host = \GO::config()->serverclient_smtp_host;
$accountModel->smtp_port = \GO::config()->serverclient_smtp_port;
$accountModel->smtp_encryption = \GO::config()->serverclient_smtp_encryption;
$accountModel->smtp_username = \GO::config()->serverclient_smtp_username;
$accountModel->smtp_password = \GO::config()->serverclient_smtp_password;
$accountModel->save();
$alias = strpos($user->email, '@' . $domainName) ? $user->email : $accountModel->username;
if (!strpos($alias, '@')) {
$alias .= '@' . $domainName;
}
$accountModel->addAlias($alias, $user->name);
}
}
示例2: 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);
}
示例3: 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;
}
示例4: 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();
}
示例5: actionLoad
protected function actionLoad($params)
{
$scheduleCall = new \GO\Tasks\Model\Task();
$remoteComboFields = array('category_id' => '$model->category->name', 'tasklist_id' => '$model->tasklist->name');
if (\GO::modules()->projects) {
$remoteComboFields['project_id'] = '$model->project->path';
}
echo $this->renderForm($scheduleCall, $remoteComboFields);
}
示例6: send
public function send(\Swift_Mime_Message $message, &$failedRecipients = null)
{
if (!empty(\GO::config()->disable_mail)) {
throw new \Exception("E-mail sending is disabled!");
}
if (\GO::config()->debug) {
$getTo = $message->getTo();
if (!empty($getTo)) {
$getTo = implode(",", array_keys($getTo));
} else {
$getTo = '';
}
\GO::debug("Sending e-mail to " . $getTo);
}
if (\GO::modules()->isInstalled("log")) {
$str = "";
$from = $message->getFrom();
if (!empty($from)) {
$str .= implode(",", array_keys($from));
} else {
$str .= "unknown";
}
$str .= " -> ";
$to = $message->getTo();
if (!empty($to)) {
$str .= implode(",", array_keys($to));
}
$to = $message->getCc();
if (!empty($to)) {
$str .= implode(",", array_keys($to));
}
$to = $message->getBcc();
if (!empty($to)) {
$str .= implode(",", array_keys($to));
}
\GO\Log\Model\Log::create("email", $str);
}
// debug_print_backtrace();
// exit("NO MAIL");
//workaround https://github.com/swiftmailer/swiftmailer/issues/335
$messageId = $message->getId();
$count = parent::send($message, $failedRecipients);
$message->setId($messageId);
// Check if a tmp dir is created to store attachments.
// If so, then remove the tmp dir if the mail is send successfully.
$tmpDir = $message->getTmpDir();
if (!empty($tmpDir)) {
$folder = new \GO\Base\Fs\Folder($tmpDir);
// Check if folder is deleted successfully
if ($folder->delete()) {
\GO::debug('Clear attachments tmp directory: ' . $tmpDir);
} else {
\GO::debug('Failed to clear attachments tmp directory: ' . $tmpDir);
}
}
return $count;
}
示例7: initListeners
public static function initListeners()
{
if (\GO::modules()->isInstalled('calendar')) {
\GO\Calendar\Model\Event::model()->addListener("delete", "GO\\Caldav\\CaldavModule", "deleteEvent");
}
if (\GO::modules()->isInstalled('tasks')) {
\GO\Tasks\Model\Task::model()->addListener("delete", "GO\\Caldav\\CaldavModule", "deleteTask");
}
}
示例8: formatStoreRecord
public function formatStoreRecord($record, $model, $store)
{
$record['user_name'] = $model->user ? $model->user->name : 'unknown';
if (\GO::modules()->customfields) {
$record['contactCustomfields'] = \GO\Customfields\Controller\CategoryController::getEnabledCategoryData("GO\\Addressbook\\Model\\Contact", $model->id);
$record['companyCustomfields'] = \GO\Customfields\Controller\CategoryController::getEnabledCategoryData("GO\\Addressbook\\Model\\Company", $model->id);
}
return parent::formatStoreRecord($record, $model, $store);
}
示例9: afterSave
protected function afterSave($wasNew)
{
if ($this->aclItem) {
//Add log message for activitylog here
if (\GO::modules()->isInstalled("log")) {
\GO\Log\Model\Log::create("acl", $this->aclItem->description, $this->aclItem->className(), $this->aclItem->id);
}
$this->aclItem->touch();
}
return parent::afterSave($wasNew);
}
示例10: getThumbURL
protected function getThumbURL()
{
if ($this->logo != '') {
if ($this->public_icon == '1') {
return \GO::modules()->host . 'modules/bookmarks/' . $this->logo;
} else {
return \GO::url('core/thumb', array('src' => $this->logo, 'w' => 16, 'h' => 16));
}
} else {
return false;
}
}
示例11: checkDatabase
public function checkDatabase()
{
//delete if module is no longer installed. This should happen automatically
//after module uninstall but in some cases this went wrong.
$parts = explode('\\', $this->model_name);
$module = strtolower($parts[1]);
if ($module != 'base' && !\GO::modules()->isInstalled($module)) {
$this->delete();
} else {
return parent::checkDatabase();
}
}
示例12: cacheListeners
/**
* Will check if the event listeners have been cached and will
* cache them when necessary.
*
* At the moment this function is called in index.php In the future this
* should be called at the new entry point of the application.
*/
public static function cacheListeners()
{
\GO::debug("GO\\Base\\Observable::cacheListeners");
$cacheFolder = \GO::config()->getCacheFolder();
$folder = $cacheFolder->createChild('listeners', false);
if (\GO::config()->debug) {
$folder->delete();
}
if (!$folder->exists()) {
$folder->create();
\GO::modules()->callModuleMethod('initListeners');
}
}
示例13: install
public function install()
{
if (\GO::modules()->isInstalled('site')) {
$alreadyExists = \GO\Site\Model\Site::model()->findSingleByAttribute('module', 'defaultsite');
if (!$alreadyExists) {
$siteProperties = array('name' => \GO::t('name', 'defaultsite'), 'user_id' => 1, 'domain' => '*', 'module' => 'defaultsite', 'ssl' => '0', 'mod_rewrite' => '0', 'mod_rewrite_base_path' => '/', 'base_path' => '', 'language' => '');
$defaultSite = new \GO\Site\Model\Site();
$defaultSite->setAttributes($siteProperties);
$defaultSite->save();
}
}
return parent::install();
}
示例14: getAllCronJobClasses
/**
* Get all available CronJobClasses
*
* @return array
*/
public function getAllCronJobClasses()
{
$modules = \GO::modules()->getAllModules();
$foundCronJobClasses = array();
foreach ($modules as $module) {
if (in_array($module->id, $this->_excludedModules)) {
continue;
}
$foundCronJobClasses = array_merge($this->getModuleCronJobClasses($module), $foundCronJobClasses);
}
$foundCronJobClasses = array_merge($this->getCoreCronJobClasses(), $foundCronJobClasses);
$foundCronJobClasses = array_merge($this->getFileStorageCronJobClasses(), $foundCronJobClasses);
return $foundCronJobClasses;
}
示例15: actionLoad
protected function actionLoad($params)
{
$user = \GO\Base\Model\User::model()->findByPk($params['id']);
$response['data'] = $user->getAttributes('formatted');
unset($response['data']['password']);
if ($user->contact) {
$response['data'] = array_merge($response['data'], $user->contact->getAttributes('formatted'));
}
if (!empty($response['data']['date_separator']) && !empty($response['data']['date_format'])) {
$response['data']['dateformat'] = $response['data']['date_separator'] . ':' . $response['data']['date_format'];
}
$response['success'] = true;
\GO::modules()->callModuleMethod('loadSettings', array(&$this, &$params, &$response, $user));
return $response;
}