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


PHP Admin_Controller::getInstance方法代码示例

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


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

示例1: getRegistryData

 /**
  * Returns registry data of admin.
  * @see Tinebase_Application_Json_Abstract
  * 
  * @return mixed array 'variable name' => 'data'
  */
 public function getRegistryData()
 {
     $appConfigDefaults = Admin_Controller::getInstance()->getConfigSettings();
     $smtpConfig = Tinebase_Config::getInstance()->getConfigAsArray(Tinebase_Config::SMTP);
     $registryData = array('manageSAM' => $this->_manageSAM, 'manageImapEmailUser' => $this->_manageImapEmailUser, 'manageSmtpEmailUser' => $this->_manageSmtpEmailUser, 'primarydomain' => array_key_exists('primarydomain', $smtpConfig) ? $smtpConfig['primarydomain'] : '', 'secondarydomains' => array_key_exists('secondarydomains', $smtpConfig) ? $smtpConfig['secondarydomains'] : '', 'defaultPrimaryGroup' => Tinebase_Group::getInstance()->getDefaultGroup()->toArray(), 'defaultInternalAddressbook' => $appConfigDefaults[Admin_Model_Config::DEFAULTINTERNALADDRESSBOOK] !== NULL ? Tinebase_Container::getInstance()->get($appConfigDefaults[Admin_Model_Config::DEFAULTINTERNALADDRESSBOOK])->toArray() : NULL);
     return $registryData;
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:13,代码来源:Json.php

示例2: preforward

 /**
  * View の処理を実行する
  * @access public
  * @see Admin_ViewClass::preforward()
  */
 function preforward($param = false)
 {
     if ($param !== false) {
         $logger = Admin_Controller::getInstance()->getLogger();
         $logger->log(LOG_ERR, $param);
     }
     header("HTTP/1.1 304 Not Modified");
     exit;
 }
开发者ID:weiweiabc109,项目名称:test_project1,代码行数:14,代码来源:304.php

示例3: performance

function performance()
{
    global $time, $mem;
    // Logにパフォーマンス情報を書き込む
    $action = Admin_Controller::getInstance()->getCurrentActionName();
    $logger = Admin_Controller::getInstance()->getBackend()->getLogger();
    $logger->begin();
    $logger->log(LOG_INFO, $action . ': peak memory: ' . memory_get_peak_usage() / 1024 / 1024 . 'Mb' . ': diff memory: ' . (memory_get_peak_usage() - $mem) / 1024 / 1024 . 'Mb' . ': ececute time: ' . (microtime(true) - $time) . 's' . ': timestamp: ' . time());
    $logger->end();
}
开发者ID:weiweiabc109,项目名称:test_project1,代码行数:10,代码来源:index.php

示例4: update_0

 /**
  * update to 3.1
  * - add DEFAULTINTERNALADDRESSBOOK
  * @return void
  */
 public function update_0()
 {
     $settings = Admin_Controller::getInstance()->getConfigSettings();
     if (!array_key_exists(Admin_Model_Config::DEFAULTINTERNALADDRESSBOOK, $settings)) {
         try {
             $internalAddressbook = Tinebase_Container::getInstance()->getContainerByName('Addressbook', 'Internal Contacts', Tinebase_Model_Container::TYPE_SHARED);
             Admin_Controller::getInstance()->saveConfigSettings(array(Admin_Model_Config::DEFAULTINTERNALADDRESSBOOK => $internalAddressbook->getId()));
         } catch (Tinebase_Exception_NotFound $tenf) {
             // do nothing
         }
     }
     $this->setApplicationVersion('Admin', '3.1');
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:18,代码来源:Release3.php

示例5: _getDefaultInternalAddressbook

 /**
  * get default internal adb id
  * 
  * @return string
  */
 protected function _getDefaultInternalAddressbook()
 {
     $appConfigDefaults = Admin_Controller::getInstance()->getConfigSettings();
     $result = isset($appConfigDefaults[Admin_Model_Config::DEFAULTINTERNALADDRESSBOOK]) ? $appConfigDefaults[Admin_Model_Config::DEFAULTINTERNALADDRESSBOOK] : NULL;
     if (empty($result)) {
         if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) {
             Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__ . ' Default internal addressbook not found. Creating new config setting.');
         }
         $result = Addressbook_Setup_Initialize::setDefaultInternalAddressbook()->getId();
     }
     return $result;
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:17,代码来源:List.php

示例6: testSyncLists

 /**
  * testSyncLists
  * 
  * @see 0005768: create addressbook lists when migrating users
  * 
  * @todo make this work for LDAP accounts backend: currently the user is not present in sync backend but in sql
  */
 public function testSyncLists()
 {
     if (Tinebase_Group::getInstance() instanceof Tinebase_Group_Ldap) {
         $this->markTestSkipped('@todo make this work for LDAP accounts backend');
     }
     $testGroup = $this->testAddGroup();
     // don't use any existing persona here => will break other tests
     $testUser = new Tinebase_Model_FullUser(array('accountLoginName' => Tinebase_Record_Abstract::generateUID(), 'accountPrimaryGroup' => $testGroup->getId(), 'accountDisplayName' => Tinebase_Record_Abstract::generateUID(), 'accountLastName' => Tinebase_Record_Abstract::generateUID(), 'accountFullName' => Tinebase_Record_Abstract::generateUID(), 'visibility' => Tinebase_Model_User::VISIBILITY_DISPLAYED));
     $contact = Admin_Controller_User::getInstance()->createOrUpdateContact($testUser);
     $testUser->contact_id = $contact->getId();
     $testUser = Tinebase_User::getInstance()->addUserInSqlBackend($testUser);
     Tinebase_User::createContactForSyncedUser($testUser);
     Tinebase_User::getInstance()->updateUserInSqlBackend($testUser);
     $this->testSetGroupMembers($testGroup, array($testUser->accountId));
     Tinebase_Group::syncListsOfUserContact(array($testGroup->getId()), $testUser->contact_id);
     $group = Tinebase_Group::getInstance()->getGroupById($testGroup);
     $this->assertTrue(!empty($group->list_id), 'list id empty: ' . print_r($group->toArray(), TRUE));
     $list = Addressbook_Controller_List::getInstance()->get($group->list_id);
     $this->assertEquals($group->getId(), $list->group_id);
     $this->assertEquals($group->name, $list->name);
     $this->assertTrue(!empty($list->members), 'list members empty: ' . print_r($list->toArray(), TRUE) . ' should contain: ' . print_r($testUser->toArray(), TRUE));
     $this->assertContains($testUser->contact_id, $list->members);
     $appConfigDefaults = Admin_Controller::getInstance()->getConfigSettings();
     $this->assertTrue(!empty($appConfigDefaults), 'app config defaults empty');
     $internal = $appConfigDefaults[Admin_Model_Config::DEFAULTINTERNALADDRESSBOOK];
     $this->assertEquals($internal, $list->container_id, 'did not get correct internal container');
     // sync again -> should not change anything
     Tinebase_Group::syncListsOfUserContact(array($group->getId()), $testUser->contact_id);
     $listAgain = Addressbook_Controller_List::getInstance()->get($group->list_id);
     $this->assertEquals($list->toArray(), $listAgain->toArray());
     // change list id -> should get list by (group) name
     $group->list_id = NULL;
     $group = Tinebase_Group::getInstance()->updateGroup($group);
     Tinebase_Group::syncListsOfUserContact(array($group->getId()), $testUser->contact_id);
     $this->assertEquals($list->getId(), Tinebase_Group::getInstance()->getGroupById($group)->list_id);
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:43,代码来源:GroupTest.php

示例7: _resolveContainerNode

 /**
  * wrapper for get container functions
  *
  * @param  string $_function
  * @param  string $_ownerId    => needed for $_node == 'personal'
  * @return array of container ids
  * @throws Tinebase_Exception_UnexpectedValue
  */
 protected function _resolveContainerNode($_node, $_ownerId = NULL)
 {
     $currentAccount = Tinebase_Core::getUser();
     $appName = $this->_options['applicationName'];
     switch ($_node) {
         case 'all':
             return Tinebase_Container::getInstance()->getContainerByACL($currentAccount, $appName, $this->_requiredGrants, TRUE, $this->_options['ignoreAcl']);
         case 'personal':
             return Tinebase_Container::getInstance()->getPersonalContainer($currentAccount, $appName, $_ownerId, $this->_requiredGrants, $this->_options['ignoreAcl'])->getId();
         case 'shared':
             return $this->_getSharedContainer($currentAccount, $appName);
         case Tinebase_Model_Container::TYPE_OTHERUSERS:
             return Tinebase_Container::getInstance()->getOtherUsersContainer($currentAccount, $appName, $this->_requiredGrants, $this->_options['ignoreAcl'])->getId();
         case 'internal':
             // @todo remove legacy code
             if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) {
                 Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__ . ' Trying to fetch obsolete "/internal" node. Please make sure this filter is no longer used because this is deprecated.');
             }
             $adminConfigDefaults = Admin_Controller::getInstance()->getConfigSettings();
             return array($adminConfigDefaults[Admin_Model_Config::DEFAULTINTERNALADDRESSBOOK]);
         default:
             throw new Tinebase_Exception_UnexpectedValue('specialNode ' . $_node . ' not supported.');
     }
     return $ids;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:33,代码来源:Container.php

示例8: testSaveHiddenAccount

 /**
  * try to save a hidden account
  */
 public function testSaveHiddenAccount()
 {
     $accountData = $this->objects['user']->toArray();
     $accountData['visibility'] = Tinebase_Model_User::VISIBILITY_HIDDEN;
     $accountData['container_id'] = 0;
     $account = $this->_createUser($accountData);
     $this->assertTrue(is_array($account));
     $this->assertTrue(!empty($account['contact_id']));
     $appConfigDefaults = Admin_Controller::getInstance()->getConfigSettings();
     $this->assertEquals($appConfigDefaults[Admin_Model_Config::DEFAULTINTERNALADDRESSBOOK], $account['container_id']['id']);
 }
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:14,代码来源:JsonTest.php

示例9: getDefaultInternalAddressbook

 /**
  * returns default internal addressbook container
  * 
  * @return string|int ID
  */
 public function getDefaultInternalAddressbook()
 {
     $appConfigDefaults = Admin_Controller::getInstance()->getConfigSettings();
     if (empty($appConfigDefaults[Admin_Model_Config::DEFAULTINTERNALADDRESSBOOK])) {
         $internalAdb = Addressbook_Setup_Initialize::setDefaultInternalAddressbook();
         $internalAdbId = $internalAdb->getId();
     } else {
         $internalAdbId = $appConfigDefaults[Admin_Model_Config::DEFAULTINTERNALADDRESSBOOK];
     }
     return $internalAdbId;
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:16,代码来源:User.php

示例10: testGetSaveApplicationConfig

 /**
  * testGetSaveApplicationConfig
  */
 public function testGetSaveApplicationConfig()
 {
     $config = $this->_instance->getConfig('Admin');
     $this->assertGreaterThan(0, count($config));
     $data = array('id' => 'Admin', 'settings' => Admin_Controller::getInstance()->getConfigSettings());
     $newConfig = $this->_instance->saveConfig($data);
     $this->assertEquals($config, $newConfig);
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:11,代码来源:JsonTest.php

示例11: testInternalAddressbookConfig

 /**
  * testInternalAddressbookConfig
  * 
  * @see http://forge.tine20.org/mantisbt/view.php?id=5846
  */
 public function testInternalAddressbookConfig()
 {
     $list = $this->objects['initialList'];
     $list->container_id = NULL;
     $listBackend = new Addressbook_Backend_List();
     $listBackend->update($list);
     Admin_Config::getInstance()->delete(Tinebase_Config::APPDEFAULTS);
     $list = Addressbook_Controller_List::getInstance()->addListMember($list, $this->objects['contact1']);
     $appConfigDefaults = Admin_Controller::getInstance()->getConfigSettings();
     $this->assertTrue(!empty($appConfigDefaults[Admin_Model_Config::DEFAULTINTERNALADDRESSBOOK]), print_r($appConfigDefaults, TRUE));
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:16,代码来源:ListControllerTest.php

示例12: checkSystemContainer

 /**
  * checks if container to delete is a "system" container 
  * 
  * @param array|integer|Tinebase_Model_Container $containerIds
  * @throws Tinebase_Exception_Record_SystemContainer
  * 
  * @TODO: generalize when there are more "system" containers
  * @todo move Admin_Model_Config::DEFAULTINTERNALADDRESSBOOK to adb config
  */
 public function checkSystemContainer($containerIds)
 {
     if (!is_array($containerIds)) {
         $containerIds = array($containerIds);
     }
     $appConfigDefaults = Admin_Controller::getInstance()->getConfigSettings();
     // at the moment, just the internal addressbook is checked
     try {
         $defaultAddressbook = $this->get($appConfigDefaults[Admin_Model_Config::DEFAULTINTERNALADDRESSBOOK])->toArray();
     } catch (Tinebase_Exception_NotFound $e) {
         $defaultAddressbook = null;
     }
     if ($defaultAddressbook && in_array($defaultAddressbook['id'], $containerIds)) {
         // _('You are not allowed to delete this Container. Please define another container as the default addressbook for internal contacts!')
         throw new Tinebase_Exception_Record_SystemContainer('You are not allowed to delete this Container. Please define another container as the default addressbook for internal contacts!');
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:26,代码来源:Container.php

示例13: createOrUpdateContact

 /**
  * create or update contact in addressbook backend
  * 
  * @param  Tinebase_Model_FullUser $_user
  * @return Addressbook_Model_Contact
  */
 public function createOrUpdateContact(Tinebase_Model_FullUser $_user)
 {
     $contactsBackend = Addressbook_Backend_Factory::factory(Addressbook_Backend_Factory::SQL);
     $contactsBackend->setGetDisabledContacts(true);
     if (empty($_user->container_id)) {
         $appConfigDefaults = Admin_Controller::getInstance()->getConfigSettings();
         $_user->container_id = $appConfigDefaults[Admin_Model_Config::DEFAULTINTERNALADDRESSBOOK];
     }
     try {
         if (empty($_user->contact_id)) {
             // jump to catch block
             throw new Tinebase_Exception_NotFound('contact_id is empty');
         }
         $contact = $contactsBackend->get($_user->contact_id);
         // update exisiting contact
         $contact->n_family = $_user->accountLastName;
         $contact->n_given = $_user->accountFirstName;
         $contact->n_fn = $_user->accountFullName;
         $contact->n_fileas = $_user->accountDisplayName;
         $contact->email = $_user->accountEmailAddress;
         $contact->type = Addressbook_Model_Contact::CONTACTTYPE_USER;
         $contact->container_id = $_user->container_id;
         // add modlog info
         Tinebase_Timemachine_ModificationLog::setRecordMetaData($contact, 'update');
         $contact = $contactsBackend->update($contact);
     } catch (Tinebase_Exception_NotFound $tenf) {
         // add new contact
         $contact = new Addressbook_Model_Contact(array('n_family' => $_user->accountLastName, 'n_given' => $_user->accountFirstName, 'n_fn' => $_user->accountFullName, 'n_fileas' => $_user->accountDisplayName, 'email' => $_user->accountEmailAddress, 'type' => Addressbook_Model_Contact::CONTACTTYPE_USER, 'container_id' => $_user->container_id));
         // add modlog info
         Tinebase_Timemachine_ModificationLog::setRecordMetaData($contact, 'create');
         $contact = $contactsBackend->create($contact);
     }
     return $contact;
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:40,代码来源:User.php

示例14: testSyncLists

 /**
  * testSyncLists
  * 
  * @see http://forge.tine20.org/mantisbt/view.php?id=5768
  */
 public function testSyncLists()
 {
     $group = $this->objects['initialGroup'];
     Tinebase_User::syncContact($this->objects['account1']);
     Tinebase_User::getInstance()->updateUserInSqlBackend($this->objects['account1']);
     $this->testSetGroupMembers();
     Tinebase_Group::syncListsOfUserContact(array($group->getId()), $this->objects['account1']->contact_id);
     $group = Tinebase_Group::getInstance()->getGroupById($this->objects['initialGroup']);
     $this->assertTrue(!empty($group->list_id), 'list id empty: ' . print_r($group->toArray(), TRUE));
     $list = Addressbook_Controller_List::getInstance()->get($group->list_id);
     $this->assertEquals($group->getId(), $list->group_id);
     $this->assertEquals($group->name, $list->name);
     $this->assertTrue(!empty($list->members), 'list members empty: ' . print_r($list->toArray(), TRUE));
     $this->assertEquals($this->objects['account1']->contact_id, $list->members[0]);
     $appConfigDefaults = Admin_Controller::getInstance()->getConfigSettings();
     $internal = $appConfigDefaults[Admin_Model_Config::DEFAULTINTERNALADDRESSBOOK];
     $this->assertEquals($internal, $list->container_id);
     // sync again -> should not change anything
     Tinebase_Group::syncListsOfUserContact(array($group->getId()), $this->objects['account1']->contact_id);
     $listAgain = Addressbook_Controller_List::getInstance()->get($group->list_id);
     $this->assertEquals($list->toArray(), $listAgain->toArray());
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:27,代码来源:GroupTest.php


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