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


PHP Tinebase_Helper::array_value方法代码示例

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


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

示例1: getConfig

 public static function getConfig($appName, $modelNames = null)
 {
     $mappingDriver = new Tinebase_Record_DoctrineMappingDriver();
     if (!$modelNames) {
         $modelNames = array();
         foreach ($mappingDriver->getAllClassNames() as $modelName) {
             $modelConfig = $modelName::getConfiguration();
             if ($modelConfig->getApplName() == $appName) {
                 $modelNames[] = $modelName;
             }
         }
     }
     $tableNames = array();
     foreach ($modelNames as $modelName) {
         $modelConfig = $modelName::getConfiguration();
         if (!$mappingDriver->isTransient($modelName)) {
             throw new Setup_Exception('Model not yet doctrine2 ready');
         }
         $tableNames[] = SQL_TABLE_PREFIX . Tinebase_Helper::array_value('name', $modelConfig->getTable());
     }
     $config = Setup::createConfiguration();
     $config->setMetadataDriverImpl($mappingDriver);
     $config->setFilterSchemaAssetsExpression('/' . implode('|', $tableNames) . '/');
     return $config;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:25,代码来源:SchemaTool.php

示例2: getFilterImap

 /**
  *
  * @return type
  */
 public function getFilterImap()
 {
     $format = "d-M-Y";
     // prepare value
     $value = (array) $this->_getDateValues($this->_operator, $this->_value);
     $timezone = Tinebase_Helper::array_value('timezone', $this->_options);
     $timezone = $timezone ? $timezone : Tinebase_Core::getUserTimezone();
     foreach ($value as &$date) {
         $date = new Tinebase_DateTime($date);
         // should be in user timezone
         $date->setTimezone(new DateTimeZone($timezone));
     }
     switch ($this->_operator) {
         case 'within':
         case 'inweek':
             $value[1]->add(new DateInterval('P1D'));
             // before is not inclusive, so we have to add a day
             $return = "SINCE {$value[0]->format($format)} BEFORE {$value[1]->format($format)}";
             break;
         case 'before':
             $return = "BEFORE {$value[0]->format($format)}";
             break;
         case 'after':
             $return = "SINCE {$value[0]->format($format)}";
             break;
         case 'equals':
             $return = "ON {$value[0]->format($format)}";
     }
     return $return;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:34,代码来源:DateTime.php

示例3: getChildren

 /**
  * (non-PHPdoc)
  * @see Tinebase_WebDav_Collection_AbstractContainerTree::getChildren()
  */
 public function getChildren()
 {
     $children = parent::getChildren();
     // do this only for caldav request
     if ($this->_useIdAsName && count($this->_getPathParts()) == 2 && Tinebase_Core::getUser()->hasRight('Tasks', Tinebase_Acl_Rights::RUN)) {
         $tfwdavct = new Tasks_Frontend_WebDAV('tasks/' . Tinebase_Helper::array_value(1, $this->_getPathParts()), $this->_useIdAsName);
         $children = array_merge($children, $tfwdavct->getChildren());
     }
     return $children;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:14,代码来源:WebDAV.php

示例4: testMaintenanceModeLoginFail

 /**
  * testMaintenanceModeLoginFail
  */
 public function testMaintenanceModeLoginFail()
 {
     if (Tinebase_User::getConfiguredBackend() === Tinebase_User::LDAP || Tinebase_User::getConfiguredBackend() === Tinebase_User::ACTIVEDIRECTORY) {
         $this->markTestSkipped('FIXME: Does not work with LDAP/AD backend (full test suite run)');
     }
     Tinebase_Config::getInstance()->maintenanceMode = 1;
     try {
         $this->_instance->login('sclever', Tinebase_Helper::array_value('password', TestServer::getInstance()->getTestCredentials()), new \Zend\Http\PhpEnvironment\Request());
         $this->fail('expecting exception: Tinebase_Exception_MaintenanceMode');
     } catch (Tinebase_Exception_MaintenanceMode $temm) {
         $this->assertEquals('Installation is in maintenance mode. Please try again later', $temm->getMessage());
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:16,代码来源:ControllerTest.php

示例5: testSetGrantsCacheInvalidation

 /**
  * cache invalidation needs a second 
  */
 public function testSetGrantsCacheInvalidation()
 {
     $container = $this->objects['initialContainer'];
     $sclever = Tinebase_Helper::array_value('sclever', Zend_Registry::get('personas'));
     $this->assertEquals(FALSE, $this->_instance->hasGrant($sclever->getId(), $container->getId(), Tinebase_Model_Grants::GRANT_READ), 'sclever should _not_ have a read grant');
     // have readGrant for sclever
     $this->_instance->setGrants($container->getId(), new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array('account_id' => Tinebase_Core::getUser()->getId(), 'account_type' => 'user', Tinebase_Model_Grants::GRANT_ADMIN => true), array('account_id' => $sclever->getId(), 'account_type' => 'user', Tinebase_Model_Grants::GRANT_READ => true))), TRUE);
     sleep(1);
     $this->assertEquals(TRUE, $this->_instance->hasGrant($sclever->getId(), $container->getId(), Tinebase_Model_Grants::GRANT_READ), 'sclever _should have_ a read grant');
     // remove readGrant for sclever again
     $this->_instance->setGrants($container->getId(), new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array('account_id' => Tinebase_Core::getUser()->getId(), 'account_type' => 'user', Tinebase_Model_Grants::GRANT_ADMIN => true), array('account_id' => $sclever->getId(), 'account_type' => 'user', Tinebase_Model_Grants::GRANT_READ => false))), TRUE);
     sleep(1);
     $this->assertEquals(FALSE, $this->_instance->hasGrant($sclever->getId(), $container->getId(), Tinebase_Model_Grants::GRANT_READ), 'sclever should _not_ have a read grant');
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:17,代码来源:ContainerTest.php

示例6: _getApplicationName

 /**
  * return application name
  * 
  * @return string
  */
 protected function _getApplicationName()
 {
     if (!$this->_applicationName) {
         $this->_applicationName = Tinebase_Helper::array_value(0, explode('_', get_class($this)));
     }
     return $this->_applicationName;
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:12,代码来源:AbstractContainerTree.php

示例7: updateSchema

 /**
  * update schema of modelconfig enabled app
  *
  * @param string $appName
  * @param array $modelNames
  * @throws Setup_Exception_NotFound
  */
 public function updateSchema($appName, $modelNames)
 {
     $updateRequired = false;
     $setNewVersions = array();
     foreach ($modelNames as $modelName) {
         $modelConfig = $modelName::getConfiguration();
         $tableName = Tinebase_Helper::array_value('name', $modelConfig->getTable());
         $currentVersion = $this->getTableVersion($tableName);
         $schemaVersion = $modelConfig->getVersion();
         if ($currentVersion < $schemaVersion) {
             $updateRequired = true;
             $setNewVersions[$tableName] = $schemaVersion;
         }
     }
     if ($updateRequired) {
         Setup_SchemaTool::updateSchema($appName, $modelNames);
         foreach ($setNewVersions as $table => $version) {
             $this->setTableVersion($table, $version);
         }
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:28,代码来源:Abstract.php

示例8: _appendEffectiveGrantCalculationSql

 /**
  * appends effective grant calculation to select object
  *
  * @param Zend_Db_Select $_select
  */
 protected function _appendEffectiveGrantCalculationSql($_select, $_attendeeFilters = NULL)
 {
     // groupmemberships of current user, needed to compute phys and inherited grants
     $_select->joinLeft(array('groupmemberships' => $this->_tablePrefix . 'group_members'), $this->_db->quoteInto($this->_db->quoteIdentifier('groupmemberships.account_id') . ' = ?', Tinebase_Core::getUser()->getId()), array());
     // attendee joins the attendee we need to compute the curr users effective grants
     // NOTE: 2010-04 the behaviour changed. Now, only the attendee the client filters for are
     //       taken into account for grants calculation
     $attendeeWhere = FALSE;
     if (is_array($_attendeeFilters) && !empty($_attendeeFilters)) {
         $attendeeSelect = $this->_db->select();
         foreach ((array) $_attendeeFilters as $attendeeFilter) {
             if ($attendeeFilter instanceof Calendar_Model_AttenderFilter) {
                 $attendeeFilter->appendFilterSql($attendeeSelect, $this);
             }
         }
         $whereArray = $attendeeSelect->getPart(Zend_Db_Select::SQL_WHERE);
         if (!empty($whereArray)) {
             $attendeeWhere = ' AND ' . Tinebase_Helper::array_value(0, $whereArray);
         }
     }
     $_select->joinLeft(array('attendee' => $this->_tablePrefix . 'cal_attendee'), $this->_db->quoteIdentifier('attendee.cal_event_id') . ' = ' . $this->_db->quoteIdentifier('cal_events.id') . $attendeeWhere, array());
     $_select->joinLeft(array('attendeeaccounts' => $this->_tablePrefix . 'accounts'), $this->_db->quoteIdentifier('attendeeaccounts.contact_id') . ' = ' . $this->_db->quoteIdentifier('attendee.user_id') . ' AND (' . $this->_db->quoteInto($this->_db->quoteIdentifier('attendee.user_type') . '= ?', Calendar_Model_Attender::USERTYPE_USER) . ' OR ' . $this->_db->quoteInto($this->_db->quoteIdentifier('attendee.user_type') . '= ?', Calendar_Model_Attender::USERTYPE_GROUPMEMBER) . ')', array());
     $_select->joinLeft(array('attendeegroupmemberships' => $this->_tablePrefix . 'group_members'), $this->_db->quoteIdentifier('attendeegroupmemberships.account_id') . ' = ' . $this->_db->quoteIdentifier('attendeeaccounts.contact_id'), array());
     $_select->joinLeft(array('dispgrants' => $this->_tablePrefix . 'container_acl'), $this->_db->quoteIdentifier('dispgrants.container_id') . ' = ' . $this->_db->quoteIdentifier('attendee.displaycontainer_id') . ' AND ' . $this->_getContainGrantCondition('dispgrants', 'groupmemberships'), array());
     $_select->joinLeft(array('physgrants' => $this->_tablePrefix . 'container_acl'), $this->_db->quoteIdentifier('physgrants.container_id') . ' = ' . $this->_db->quoteIdentifier('cal_events.container_id'), array());
     $allGrants = Tinebase_Model_Grants::getAllGrants();
     foreach ($allGrants as $grant) {
         if (in_array($grant, $this->_recordBasedGrants)) {
             $_select->columns(array($grant => "\n MAX( CASE WHEN ( \n" . '  /* physgrant */' . $this->_getContainGrantCondition('physgrants', 'groupmemberships', $grant) . " OR \n" . '  /* implicit  */' . $this->_getImplicitGrantCondition($grant) . " OR \n" . '  /* inherited */' . $this->_getInheritedGrantCondition($grant) . " \n" . ") THEN 1 ELSE 0 END ) "));
         } else {
             $_select->columns(array($grant => "\n MAX( CASE WHEN ( \n" . '  /* physgrant */' . $this->_getContainGrantCondition('physgrants', 'groupmemberships', $grant) . "\n" . ") THEN 1 ELSE 0 END ) "));
         }
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:39,代码来源:Sql.php

示例9: _assertMail

 /**
  * checks if mail for persona got send
  * 
  * @param string $_personas
  * @param string $_assertString
  * @return void
  * 
  * @see #6800: add message-id to notification mails
  */
 protected function _assertMail($_personas, $_assertString = NULL, $_location = 'subject')
 {
     $messages = self::getMessages();
     foreach (explode(',', $_personas) as $personaName) {
         $mailsForPersona = array();
         $otherRecipients = array();
         $personaEmail = strstr($personaName, '@') ? $personaName : $this->_getPersona(trim($personaName))->accountEmailAddress;
         foreach ($messages as $message) {
             if (Tinebase_Helper::array_value(0, $message->getRecipients()) == $personaEmail) {
                 array_push($mailsForPersona, $message);
             } else {
                 array_push($otherRecipients, $message->getRecipients());
             }
         }
         if (!$_assertString) {
             $this->assertEquals(0, count($mailsForPersona), 'No mail should be send for ' . $personaName);
         } else {
             $this->assertEquals(1, count($mailsForPersona), 'One mail should be send for ' . $personaName . ' other recipients: ' . print_r($otherRecipients, true));
             $this->assertEquals('UTF-8', $mailsForPersona[0]->getCharset());
             switch ($_location) {
                 case 'subject':
                     $subject = $mailsForPersona[0]->getSubject();
                     $this->assertTrue(FALSE !== strpos($subject, $_assertString), 'Mail subject for ' . $personaName . ' should contain "' . $_assertString . '" but ' . $subject . ' is given');
                     break;
                 case 'body':
                     $bodyPart = $mailsForPersona[0]->getBodyText(FALSE);
                     // so odd!
                     $s = fopen('php://temp', 'r+');
                     fputs($s, $bodyPart->getContent());
                     rewind($s);
                     $bodyPartStream = new Zend_Mime_Part($s);
                     $bodyPartStream->encoding = $bodyPart->encoding;
                     $bodyText = $bodyPartStream->getDecodedContent();
                     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' body text: ' . $bodyText);
                     }
                     $this->assertContains($_assertString, $bodyText);
                     break;
                 default:
                     throw new Exception('no such location ' . $_location);
                     break;
             }
             $headers = $mailsForPersona[0]->getHeaders();
             $this->assertTrue(isset($headers['Message-Id']), 'message-id header not found');
             $this->assertContains('@' . php_uname('n'), $headers['Message-Id'][0], 'hostname not in message-id');
         }
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:57,代码来源:EventNotificationsTests.php

示例10: testAclSetRoles

 /**
  * test aclQuery method
  */
 public function testAclSetRoles()
 {
     // add user to grants of container
     $this->testAclAddUser();
     $body = '<?xml version="1.0" encoding="utf-8"?>
              <acl-query xmlns="urn:inverse:params:xml:ns:inverse-dav">
                  <set-roles user="' . Tinebase_Helper::array_value('pwulf', Zend_Registry::get('personas'))->contact_id . '">
                      <ObjectEraser/>
                  </set-roles>
              </acl-query>';
     $request = new Sabre\HTTP\Request(array('REQUEST_METHOD' => 'POST', 'REQUEST_URI' => '/calendars/' . Tinebase_Core::getUser()->contact_id . '/' . $this->objects['initialContainer']->id, 'HTTP_DEPTH' => '1'));
     $request->setBody($body);
     $this->server->httpRequest = $request;
     $this->server->exec();
     $this->assertEquals('HTTP/1.1 201 Created', $this->response->status);
     $grantsOfPwulf = Tinebase_Container::getInstance()->getGrantsOfContainer($this->objects['initialContainer']->id)->filter('account_id', Tinebase_Helper::array_value('pwulf', Zend_Registry::get('personas'))->accountId)->getFirstRecord();
     $this->assertTrue($grantsOfPwulf->deleteGrant);
     $this->assertFalse($grantsOfPwulf->addGrant);
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:22,代码来源:InverseTest.php

示例11: getFirstNamingContext

 /**
  * return first namingContext from LDAP root DSE
  * 
  * @return string
  */
 public function getFirstNamingContext()
 {
     return Tinebase_Helper::array_value(0, $this->getRootDse()->getNamingContexts());
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:9,代码来源:Ldap.php

示例12: testGetSharesWithoutRights

 /**
  * test Calendar_Frontend_WebDAV_Container::getShares for container user has no admin grant for
  */
 public function testGetSharesWithoutRights()
 {
     $jmcblack = Tinebase_Helper::array_value('jmcblack', Zend_Registry::get('personas'));
     $jmcblacksCalId = Tinebase_Core::getPreference('Calendar')->getValueForUser(Calendar_Preference::DEFAULTCALENDAR, $jmcblack->getId());
     $jmcblacksCal = Tinebase_Container::getInstance()->get($jmcblacksCalId);
     $container = new Calendar_Frontend_WebDAV_Container($jmcblacksCal);
     $shares = $container->getShares();
     $this->assertEquals(1, count($shares));
     $this->assertTrue((bool) $shares[0]['readOnly']);
 }
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:13,代码来源:ContainerTest.php

示例13: __construct

 /**
  * contructor
  * 
  * @param  string|Tinebase_Model_Application  $_application  the current application
  * @param  string                             $_path         the current path
  */
 public function __construct($_path)
 {
     $this->_path = $_path;
     $this->_pathParts = $this->_parsePath($_path);
     $this->_applicationName = Tinebase_Helper::array_value(0, explode('_', get_class($this)));
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:12,代码来源:Abstract.php

示例14: testAddAttachmentToRecurSeries

 /**
  * testAddAttachmentToRecurSeries
  * 
  * @see 0005024: allow to attach external files to records
  */
 public function testAddAttachmentToRecurSeries()
 {
     $tempFile = $this->_getTempFile();
     $recurSet = Tinebase_Helper::array_value('results', $this->testSearchRecuringIncludes());
     // update recurseries
     $someRecurInstance = $recurSet[2];
     $someRecurInstance['attachments'] = array(array('tempFile' => array('id' => $tempFile->getId())));
     $someRecurInstance['seq'] = 2;
     $this->_uit->updateRecurSeries($someRecurInstance, FALSE, FALSE);
     $searchResultData = $this->_searchRecurSeries($recurSet[0]);
     foreach ($searchResultData['results'] as $recurInstance) {
         $this->assertTrue(isset($recurInstance['attachments']), 'no attachments found in event: ' . print_r($recurInstance, TRUE));
         $this->assertEquals(1, count($recurInstance['attachments']));
         $attachment = $recurInstance['attachments'][0];
         $this->assertEquals('text/plain', $attachment['contenttype'], print_r($attachment, TRUE));
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:22,代码来源:JsonTests.php

示例15: _getAccountMetaData

 /**
  * returns a single account dn
  *
  * @param string $_accountId
  * @return string
  */
 protected function _getAccountMetaData($_accountId)
 {
     return Tinebase_Helper::array_value(0, $this->_getAccountsMetaData(array($_accountId)));
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:10,代码来源:Ldap.php


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