• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Tinebase_Group类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _recordToJson

 /**
  * returns record prepared for json transport
  *
  * @param Tinebase_Record_Interface $_record
  * @return array record data
  */
 protected function _recordToJson($_record)
 {
     switch (get_class($_record)) {
         case 'Timetracker_Model_Timesheet':
             $_record['timeaccount_id'] = $_record['timeaccount_id'] ? $this->_timeaccountController->get($_record['timeaccount_id']) : $_record['timeaccount_id'];
             $_record['timeaccount_id']['account_grants'] = Timetracker_Model_TimeaccountGrants::getGrantsOfAccount(Tinebase_Core::get('currentAccount'), $_record['timeaccount_id']);
             $_record['timeaccount_id']['account_grants'] = $this->_resolveTimesheetGrantsByTimeaccountGrants($_record['timeaccount_id']['account_grants'], $_record['account_id']);
             Tinebase_User::getInstance()->resolveUsers($_record, 'account_id');
             $recordArray = parent::_recordToJson($_record);
             break;
         case 'Timetracker_Model_Timeaccount':
             $recordArray = parent::_recordToJson($_record);
             // When editing a single TA we send _ALL_ grants to the client
             $recordArray['grants'] = Timetracker_Model_TimeaccountGrants::getTimeaccountGrants($_record)->toArray();
             foreach ($recordArray['grants'] as &$value) {
                 switch ($value['account_type']) {
                     case Tinebase_Acl_Rights::ACCOUNT_TYPE_USER:
                         $value['account_name'] = Tinebase_User::getInstance()->getUserById($value['account_id'])->toArray();
                         break;
                     case Tinebase_Acl_Rights::ACCOUNT_TYPE_GROUP:
                         $value['account_name'] = Tinebase_Group::getInstance()->getGroupById($value['account_id'])->toArray();
                         break;
                     case Tinebase_Acl_Rights::ACCOUNT_TYPE_ANYONE:
                         $value['account_name'] = array('accountDisplayName' => 'Anyone');
                         break;
                     default:
                         throw new Tinebase_Exception_InvalidArgument('Unsupported accountType.');
                         break;
                 }
             }
             break;
     }
     return $recordArray;
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:40,代码来源:Json.php


示例2: toArray

 /**
  * returns array with the filter settings of this filter
  *
  * @param  bool $_valueToJson resolve value for json api?
  * @return array
  */
 public function toArray($_valueToJson = false)
 {
     $result = parent::toArray($_valueToJson);
     if ($this->_userOperator && $this->_userOperator == 'inGroup') {
         $result['operator'] = $this->_userOperator;
         $result['value'] = $this->_userValue;
     } else {
         if ($this->_userValue === Tinebase_Model_User::CURRENTACCOUNT) {
             // switch back to CURRENTACCOUNT to make sure filter is saved and shown in client correctly
             $result['value'] = $this->_userValue;
         }
     }
     if ($_valueToJson == true) {
         if ($this->_userOperator && $this->_userOperator == 'inGroup' && $this->_userValue) {
             $result['value'] = Tinebase_Group::getInstance()->getGroupById($this->_userValue)->toArray();
         } else {
             switch ($this->_operator) {
                 case 'equals':
                     $result['value'] = $result['value'] ? Tinebase_User::getInstance()->getUserById($this->_value)->toArray() : $result['value'];
                     break;
                 case 'in':
                     $result['value'] = array();
                     foreach ($this->_value as $userId) {
                         $result['value'][] = Tinebase_User::getInstance()->getUserById($userId)->toArray();
                     }
                     break;
                 default:
                     break;
             }
         }
     }
     return $result;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:39,代码来源:User.php


示例3: testEmailsToAttendeeWithGroups

 /**
  * @return void
  */
 public function testEmailsToAttendeeWithGroups()
 {
     if (Tinebase_User::getConfiguredBackend() === Tinebase_User::LDAP || Tinebase_User::getConfiguredBackend() === Tinebase_User::ACTIVEDIRECTORY) {
         $this->markTestSkipped('FIXME: Does not work with LDAP/AD backend');
     }
     $event = $this->_getEvent();
     $persistentEvent = Calendar_Controller_Event::getInstance()->create($event);
     $primaryGroup = Tinebase_Group::getInstance()->getGroupById(Tinebase_Core::getUser()->accountPrimaryGroup);
     $newAttendees = array(array('userType' => Calendar_Model_Attender::USERTYPE_USER, 'firstName' => $this->_originalTestUser->accountFirstName, 'lastName' => $this->_originalTestUser->accountLastName, 'partStat' => Calendar_Model_Attender::STATUS_TENTATIVE, 'role' => Calendar_Model_Attender::ROLE_REQUIRED, 'email' => $this->_originalTestUser->accountEmailAddress), array('userType' => Calendar_Model_Attender::USERTYPE_GROUP, 'displayName' => $primaryGroup->name, 'partStat' => Calendar_Model_Attender::STATUS_NEEDSACTION, 'role' => Calendar_Model_Attender::ROLE_REQUIRED, 'email' => '[email protected]'));
     Calendar_Model_Attender::emailsToAttendee($persistentEvent, $newAttendees, TRUE);
     $persistentEvent = Calendar_Controller_Event::getInstance()->update($persistentEvent);
     $attendees = clone $persistentEvent->attendee;
     Calendar_Model_Attender::resolveAttendee($attendees);
     $newAttendees = array();
     foreach ($attendees as $attendee) {
         $newAttendees[] = array('userType' => $attendee->user_type == 'group' ? Calendar_Model_Attender::USERTYPE_GROUP : Calendar_Model_Attender::USERTYPE_USER, 'partStat' => Calendar_Model_Attender::STATUS_TENTATIVE, 'role' => Calendar_Model_Attender::ROLE_REQUIRED, 'email' => $attendee->user_type == 'group' ? $attendee->user_id->getId() : $attendee->user_id->email, 'displayName' => $attendee->user_type == 'group' ? $attendee->user_id->name : $attendee->user_id->n_fileas);
     }
     Calendar_Model_Attender::emailsToAttendee($persistentEvent, $newAttendees, TRUE);
     $persistentEvent = Calendar_Controller_Event::getInstance()->update($persistentEvent);
     //         print_r($persistentEvent->attendee->toArray());
     // there must be more than 2 attendees the user, the group + the groupmembers
     $this->assertGreaterThan(2, count($persistentEvent->attendee));
     // current account must not be a groupmember
     $this->assertFalse(!!Calendar_Model_Attender::getAttendee($persistentEvent->attendee, new Calendar_Model_Attender(array('user_type' => Calendar_Model_Attender::USERTYPE_GROUPMEMBER, 'user_id' => $this->_originalTestUser->contact_id))), 'found user as groupmember');
     $this->assertEquals(Calendar_Model_Attender::STATUS_TENTATIVE, Calendar_Model_Attender::getOwnAttender($persistentEvent->attendee)->status);
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:29,代码来源:AttenderTests.php


示例4: _multipleRecordsToJson

 /**
  * returns multiple records prepared for json transport
  *
  * @param Tinebase_Record_RecordSet $_records
  * @param Tinebase_Model_Filter_FilterGroup $_filter
  * @param Tinebase_Model_Pagination $_pagination
  * 
  * @return array data
  */
 protected function _multipleRecordsToJson(Tinebase_Record_RecordSet $_records, $_filter = NULL, $_pagination = NULL)
 {
     $result = parent::_multipleRecordsToJson($_records, $_filter, $_pagination);
     // get groups + types (departments) and merge data
     $groupIds = $_records->group_id;
     $groups = Tinebase_Group::getInstance()->getMultiple(array_unique(array_values($groupIds)));
     $knownTypes = Tinebase_Department::getInstance()->search(new Tinebase_Model_DepartmentFilter());
     foreach ($result as &$course) {
         $groupIdx = $groups->getIndexById($course['group_id']);
         if ($groupIdx !== FALSE) {
             $group = $groups[$groupIdx]->toArray();
             unset($group['id']);
             $course = array_merge($group, $course);
         } else {
             if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) {
                 Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__ . ' Group with ID ' . $course['group_id'] . ' does not exist.');
             }
         }
         $typeIdx = $knownTypes->getIndexById($course['type']);
         if ($typeIdx !== FALSE) {
             //if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . print_r($knownTypes[$typeIdx]->toArray(), true));
             $course['type'] = $knownTypes[$typeIdx]->toArray();
         } else {
             if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) {
                 Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__ . ' Department with ID ' . $course['type'] . ' does not exist.');
             }
             $course['type'] = array('id' => $course['type'], 'name' => $course['type']);
         }
     }
     return $result;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:40,代码来源:Json.php


示例5: resetCoursesInternetAccess

 /**
  * set all courses to internet = FILTERED
  * 
  * @return integer
  */
 public function resetCoursesInternetAccess()
 {
     if (!$this->_checkAdminRight()) {
         return 2;
     }
     $config = Courses_Config::getInstance();
     if (!isset($config->{Courses_Config::INTERNET_ACCESS_GROUP_ON}) || !isset($config->{Courses_Config::INTERNET_ACCESS_GROUP_FILTERED})) {
         echo "No internet groups defined in config. Exiting\n";
         return 2;
     }
     $filter = new Courses_Model_CourseFilter(array(array('field' => 'internet', 'operator' => 'not', 'value' => 'FILTERED')));
     $count = 0;
     foreach (Courses_Controller_Course::getInstance()->search($filter) as $course) {
         $course->internet = 'FILTERED';
         $group = Tinebase_Group::getInstance()->getGroupById($course->group_id);
         $group->members = Tinebase_Group::getInstance()->getGroupMembers($group);
         try {
             Courses_Controller_Course::getInstance()->saveCourseAndGroup($course, $group);
             $count++;
         } catch (Exception $e) {
             echo 'Failed to update course: ' . $course->name . PHP_EOL;
             echo $e . PHP_EOL;
         }
     }
     echo "Updated " . $count . " Course(s)\n";
     return 0;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:32,代码来源:Cli.php


示例6: toArray

 /**
  * returns array with the filter settings of this filter
  *
  * @param  bool $_valueToJson resolve value for json api?
  * @return array
  */
 public function toArray($_valueToJson = false)
 {
     $result = parent::toArray($_valueToJson);
     if ($this->_userOperator && $this->_userOperator == 'inGroup') {
         $result['operator'] = $this->_userOperator;
         $result['value'] = $this->_userValue;
     }
     if ($_valueToJson == true) {
         if ($this->_userOperator && $this->_userOperator == 'inGroup' && $this->_userValue) {
             $result['value'] = Tinebase_Group::getInstance()->getGroupById($this->_userValue)->toArray();
         } else {
             switch ($this->_operator) {
                 case 'equals':
                     $result['value'] = $result['value'] ? Tinebase_User::getInstance()->getUserById($this->_value)->toArray() : $result['value'];
                     break;
                 case 'in':
                     $result['value'] = array();
                     foreach ($this->_value as $userId) {
                         $result['value'][] = Tinebase_User::getInstance()->getUserById($userId)->toArray();
                     }
                     break;
                 default:
                     break;
             }
         }
     }
     return $result;
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:34,代码来源:User.php


示例7: testExpandProperty

 public function testExpandProperty()
 {
     $list = Tinebase_Group::getInstance()->getGroupById(Tinebase_Core::getUser()->accountPrimaryGroup);
     $body = '<?xml version="1.0" encoding="UTF-8"?>
             <A:expand-property xmlns:A="DAV:">
               <A:property name="expanded-group-member-set" namespace="http://calendarserver.org/ns/">
                 <A:property name="last-name" namespace="http://calendarserver.org/ns/"/>
                 <A:property name="principal-URL" namespace="DAV:"/>
                 <A:property name="calendar-user-type" namespace="urn:ietf:params:xml:ns:caldav"/>
                 <A:property name="calendar-user-address-set" namespace="urn:ietf:params:xml:ns:caldav"/>
                 <A:property name="first-name" namespace="http://calendarserver.org/ns/"/>
                 <A:property name="record-type" namespace="http://calendarserver.org/ns/"/>
                 <A:property name="displayname" namespace="DAV:"/>
               </A:property>
             </A:expand-property>';
     $request = new Sabre\HTTP\Request(array('REQUEST_METHOD' => 'REPORT', 'REQUEST_URI' => '/principals/groups/' . $list->list_id . '/'));
     $request->setBody($body);
     $this->server->httpRequest = $request;
     $this->server->exec();
     $responseDoc = new DOMDocument();
     $responseDoc->loadXML($this->response->body);
     #$responseDoc->formatOutput = true; echo $responseDoc->saveXML();
     $xpath = new DomXPath($responseDoc);
     $xpath->registerNamespace('cal', 'urn:ietf:params:xml:ns:caldav');
     $xpath->registerNamespace('cs', 'http://calendarserver.org/ns/');
     $nodes = $xpath->query('///cs:expanded-group-member-set/d:response/d:href[text()="/principals/groups/' . $list->list_id . '/"]');
     $this->assertEquals(1, $nodes->length, 'group itself (not shown by client) is missing');
     $nodes = $xpath->query('///cs:expanded-group-member-set/d:response/d:href[text()="/principals/intelligroups/' . $list->list_id . '/"]');
     $this->assertEquals(1, $nodes->length, 'intelligroup (to keep group itself) is missing');
     $nodes = $xpath->query('///cs:expanded-group-member-set/d:response/d:href[text()="/principals/users/' . Tinebase_Core::getUser()->contact_id . '/"]');
     $this->assertEquals(1, $nodes->length, 'user is missing');
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:32,代码来源:ExpandedPropertiesReportTest.php


示例8: setUp

 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $this->_groupLDAP = Tinebase_Group::factory(Tinebase_Group::LDAP);
     $this->_userLDAP = Tinebase_User::factory(Tinebase_User::LDAP);
     $this->_groupSQL = Tinebase_Group::factory(Tinebase_Group::SQL);
     $this->objects['initialGroup'] = new Tinebase_Model_Group(array('name' => 'tine20phpunit', 'description' => 'initial group'));
     $this->objects['updatedGroup'] = new Tinebase_Model_Group(array('name' => 'tine20phpunit updated', 'description' => 'updated group'));
     $this->objects['initialAccount'] = new Tinebase_Model_FullUser(array('accountLoginName' => 'tine20phpunit', 'accountStatus' => 'enabled', 'accountExpires' => NULL, 'accountPrimaryGroup' => 'must be set to valid groupid', 'accountLastName' => 'Tine 2.0', 'accountFirstName' => 'PHPUnit', 'accountEmailAddress' => '[email protected]'));
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:15,代码来源:LdapTest.php


示例9: setUp

 protected function setUp()
 {
     $this->_setGeoData = Addressbook_Controller_Contact::getInstance()->setGeoDataForContacts(FALSE);
     $appName = 'Addressbook';
     ############# TEST USER ##########
     $user = new Tinebase_Model_FullUser(array('accountLoginName' => 'tine20phpunit', 'accountDisplayName' => 'tine20phpunit', 'accountStatus' => 'enabled', 'accountExpires' => NULL, 'accountPrimaryGroup' => Tinebase_Group::getInstance()->getGroupByName('Users')->getId(), 'accountLastName' => 'Tine 2.0', 'accountFirstName' => 'PHPUnit', 'accountEmailAddress' => '[email protected]'));
     try {
         $user = Tinebase_User::getInstance()->getUserByLoginName($user->accountLoginName);
     } catch (Tinebase_Exception_NotFound $e) {
         $user = Tinebase_User::getInstance()->addUser($user);
     }
     $this->objects['user'] = $user;
     ############# TEST CONTACT ##########
     try {
         $containerWithSyncGrant = Tinebase_Container::getInstance()->getContainerByName($appName, 'ContainerWithSyncGrant', Tinebase_Model_Container::TYPE_PERSONAL, Tinebase_Core::getUser());
     } catch (Tinebase_Exception_NotFound $e) {
         $containerWithSyncGrant = new Tinebase_Model_Container(array('name' => 'ContainerWithSyncGrant', 'type' => Tinebase_Model_Container::TYPE_PERSONAL, 'owner_id' => Tinebase_Core::getUser(), 'backend' => 'Sql', 'application_id' => Tinebase_Application::getInstance()->getApplicationByName($appName)->getId()));
         $containerWithSyncGrant = Tinebase_Container::getInstance()->addContainer($containerWithSyncGrant);
     }
     $this->objects['containerWithSyncGrant'] = $containerWithSyncGrant;
     try {
         $containerWithoutSyncGrant = Tinebase_Container::getInstance()->getContainerByName($appName, 'ContainerWithoutSyncGrant', Tinebase_Model_Container::TYPE_PERSONAL, Tinebase_Core::getUser());
     } catch (Tinebase_Exception_NotFound $e) {
         $creatorGrants = array('account_id' => Tinebase_Core::getUser()->getId(), 'account_type' => Tinebase_Acl_Rights::ACCOUNT_TYPE_USER, Tinebase_Model_Grants::GRANT_READ => true, Tinebase_Model_Grants::GRANT_ADD => true, Tinebase_Model_Grants::GRANT_EDIT => true, Tinebase_Model_Grants::GRANT_DELETE => true, Tinebase_Model_Grants::GRANT_ADMIN => true);
         $grants = new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array($creatorGrants));
         $containerWithoutSyncGrant = new Tinebase_Model_Container(array('name' => 'ContainerWithoutSyncGrant', 'type' => Tinebase_Model_Container::TYPE_PERSONAL, 'owner_id' => Tinebase_Core::getUser(), 'backend' => 'Sql', 'application_id' => Tinebase_Application::getInstance()->getApplicationByName($appName)->getId()));
         $containerWithSyncGrant = Tinebase_Container::getInstance()->addContainer($containerWithoutSyncGrant, $grants);
     }
     $this->objects['containerWithoutSyncGrant'] = $containerWithoutSyncGrant;
     $contact = new Addressbook_Model_Contact(array('adr_one_countryname' => 'DE', 'adr_one_locality' => 'Hamburg', 'adr_one_postalcode' => '24xxx', 'adr_one_region' => 'Hamburg', 'adr_one_street' => 'Pickhuben 4', 'adr_one_street2' => 'no second street', 'adr_two_countryname' => 'DE', 'adr_two_locality' => 'Hamburg', 'adr_two_postalcode' => '24xxx', 'adr_two_region' => 'Hamburg', 'adr_two_street' => 'Pickhuben 4', 'adr_two_street2' => 'no second street2', 'bday' => '1975-01-02 03:00:00', 'email' => '[email protected]', 'email_home' => '[email protected]', 'container_id' => $this->objects['containerWithSyncGrant']->id, 'role' => 'Role', 'n_given' => 'Lars', 'n_family' => 'Kneschke', 'n_fileas' => 'Kneschke, Lars'));
     $contact = Addressbook_Controller_Contact::getInstance()->create($contact, FALSE);
     $this->objects['contact'] = $contact;
     $unSyncableContact = new Addressbook_Model_Contact(array('adr_one_countryname' => 'DE', 'adr_one_locality' => 'Hamburg', 'adr_one_postalcode' => '24xxx', 'adr_one_region' => 'Hamburg', 'adr_one_street' => 'Pickhuben 4', 'adr_one_street2' => 'no second street', 'adr_two_countryname' => 'DE', 'adr_two_locality' => 'Hamburg', 'adr_two_postalcode' => '24xxx', 'adr_two_region' => 'Hamburg', 'adr_two_street' => 'Pickhuben 4', 'adr_two_street2' => 'no second street2', 'bday' => '1975-01-02 03:00:00', 'email' => '[email protected]', 'email_home' => '[email protected]', 'container_id' => $this->objects['containerWithoutSyncGrant']->id, 'role' => 'Role', 'n_given' => 'Lars', 'n_family' => 'Kneschke', 'n_fileas' => 'Kneschke, Lars'));
     $unSyncableContact = Addressbook_Controller_Contact::getInstance()->create($unSyncableContact, FALSE);
     $this->objects['unSyncableContact'] = $unSyncableContact;
     ########### define test filter
     $filterBackend = new Tinebase_PersistentFilter_Backend_Sql();
     try {
         $filter = $filterBackend->getByProperty('Contacts Sync Test', 'name');
     } catch (Tinebase_Exception_NotFound $e) {
         $filter = new Tinebase_Model_PersistentFilter(array('application_id' => Tinebase_Application::getInstance()->getApplicationByName('Addressbook')->getId(), 'account_id' => Tinebase_Core::getUser()->getId(), 'model' => 'Addressbook_Model_ContactFilter', 'filters' => array(array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->objects['containerWithSyncGrant']->getId())), 'name' => 'Contacts Sync Test', 'description' => 'Created by unit test'));
         $filter = $filterBackend->create($filter);
     }
     $this->objects['filter'] = $filter;
     ########### define test devices
     $palm = ActiveSync_Backend_DeviceTests::getTestDevice(Syncope_Model_Device::TYPE_WEBOS);
     $palm->contactsfilter_id = $this->objects['filter']->getId();
     $this->objects['deviceWebOS'] = ActiveSync_Controller_Device::getInstance()->create($palm);
     $iphone = ActiveSync_Backend_DeviceTests::getTestDevice(Syncope_Model_Device::TYPE_IPHONE);
     $iphone->contactsfilter_id = $this->objects['filter']->getId();
     $this->objects['deviceIPhone'] = ActiveSync_Controller_Device::getInstance()->create($iphone);
     $htcAndroid = ActiveSync_Backend_DeviceTests::getTestDevice(Syncope_Model_Device::TYPE_ANDROID);
     $htcAndroid->contactsfilter_id = $this->objects['filter']->getId();
     $this->objects['deviceAndroid'] = ActiveSync_Controller_Device::getInstance()->create($htcAndroid);
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:55,代码来源:ContactsTests.php


示例10: setUp

 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     parent::setUp();
     $this->objects['application'] = Tinebase_Application::getInstance()->getApplicationByName('Crm');
     $this->objects['user'] = new Tinebase_Model_FullUser(array('accountLoginName' => 'crmtine20phpunit', 'accountDisplayName' => 'crmtine20phpunit', 'accountStatus' => 'enabled', 'accountExpires' => NULL, 'accountPrimaryGroup' => Tinebase_Group::getInstance()->getDefaultGroup()->getId(), 'accountLastName' => 'Tine 2.0', 'accountFirstName' => 'crmPHPUnit', 'accountEmailAddress' => '[email protected]'));
     $this->objects['role'] = new Tinebase_Model_Role(array('id' => 10, 'name' => 'phpunitrole', 'description' => 'test role for phpunit'));
     $this->objects['role_2'] = new Tinebase_Model_Role(array('id' => 11, 'name' => 'phpunitrole 2', 'description' => 'test role 2 for phpunit'));
     // add account for group / role member tests
     $this->objects['user'] = Tinebase_User::getInstance()->addUser($this->objects['user']);
     Tinebase_Group::getInstance()->addGroupMember($this->objects['user']->accountPrimaryGroup, $this->objects['user']);
     return;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:18,代码来源:RolesTest.php


示例11: setUp

 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $this->objects['initialGroup'] = new Tinebase_Model_Group(array('id' => 'test-controller-group', 'name' => 'tine20phpunit', 'description' => 'initial test group'));
     $this->objects['updatedGroup'] = new Tinebase_Model_Group(array('id' => 'test-controller-group', 'name' => 'tine20phpunit updated', 'description' => 'updated test group'));
     $this->objects['initialAccount'] = new Tinebase_Model_FullUser(array('accountId' => 'dflkjgldfgdfgd', 'accountLoginName' => 'tine20phpunit', 'accountStatus' => 'enabled', 'accountExpires' => NULL, 'accountPrimaryGroup' => Tinebase_Group::getInstance()->getGroupByName('Users')->id, 'accountLastName' => 'Tine 2.0', 'accountFirstName' => 'PHPUnit', 'accountEmailAddress' => '[email protected]'));
     $this->objects['updatedAccount'] = new Tinebase_Model_FullUser(array('accountLoginName' => 'tine20phpunit-updated', 'accountStatus' => 'disabled', 'accountExpires' => NULL, 'accountPrimaryGroup' => Tinebase_Group::getInstance()->getGroupByName('Users')->id, 'accountLastName' => 'Tine 2.0 Updated', 'accountFirstName' => 'PHPUnit Updated', 'accountEmailAddress' => '[email protected]'));
     if (Tinebase_Application::getInstance()->isInstalled('Addressbook') === true) {
         $internalAddressbook = Tinebase_Container::getInstance()->getContainerByName('Addressbook', 'Internal Contacts', Tinebase_Model_Container::TYPE_SHARED);
         $this->objects['initialGroup']->container_id = $internalAddressbook->getId();
         $this->objects['updatedGroup']->container_id = $internalAddressbook->getId();
         $this->objects['initialAccount']->container_id = $internalAddressbook->getId();
         $this->objects['updatedAccount']->container_id = $internalAddressbook->getId();
     }
     return;
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:21,代码来源:ControllerTest.php


示例12: setUp

 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $this->objects['application'] = Tinebase_Application::getInstance()->getApplicationByName('Crm');
     $this->objects['user'] = new Tinebase_Model_FullUser(array('accountId' => 10, 'accountLoginName' => 'tine20phpunit', 'accountDisplayName' => 'tine20phpunit', 'accountStatus' => 'enabled', 'accountExpires' => NULL, 'accountPrimaryGroup' => Tinebase_Group::getInstance()->getGroupByName('Users')->getId(), 'accountLastName' => 'Tine 2.0', 'accountFirstName' => 'PHPUnit', 'accountEmailAddress' => '[email protected]'));
     $this->objects['role'] = new Tinebase_Model_Role(array('id' => 10, 'name' => 'phpunitrole', 'description' => 'test role for phpunit'));
     $this->objects['role_2'] = new Tinebase_Model_Role(array('id' => 11, 'name' => 'phpunitrole 2', 'description' => 'test role 2 for phpunit'));
     $translate = Tinebase_Translation::getTranslation('Tinebase');
     // add account for group / role member tests
     try {
         $user = Tinebase_User::getInstance()->getUserById($this->objects['user']->accountId);
     } catch (Tinebase_Exception_NotFound $e) {
         $user = Tinebase_User::getInstance()->addUser($this->objects['user']);
         Tinebase_Group::getInstance()->addGroupMember($user->accountPrimaryGroup, $user);
     }
     return;
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:22,代码来源:RolesTest.php


示例13: testEmailsToAttendeeWithGroups

 /**
  * @return void
  */
 public function testEmailsToAttendeeWithGroups()
 {
     $event = $this->_getEvent();
     $persistentEvent = Calendar_Controller_Event::getInstance()->create($event);
     $primaryGroup = Tinebase_Group::getInstance()->getGroupById(Tinebase_Core::getUser()->accountPrimaryGroup);
     $newAttendees = array(array('userType' => Calendar_Model_Attender::USERTYPE_USER, 'firstName' => $this->_testUser->accountFirstName, 'lastName' => $this->_testUser->accountLastName, 'partStat' => Calendar_Model_Attender::STATUS_TENTATIVE, 'role' => Calendar_Model_Attender::ROLE_REQUIRED, 'email' => $this->_testUser->accountEmailAddress), array('userType' => Calendar_Model_Attender::USERTYPE_GROUP, 'displayName' => $primaryGroup->name, 'partStat' => Calendar_Model_Attender::STATUS_NEEDSACTION, 'role' => Calendar_Model_Attender::ROLE_REQUIRED, 'email' => '[email protected]'));
     Calendar_Model_Attender::emailsToAttendee($persistentEvent, $newAttendees, TRUE);
     $persistentEvent = Calendar_Controller_Event::getInstance()->update($persistentEvent);
     $attendees = clone $persistentEvent->attendee;
     Calendar_Model_Attender::resolveAttendee($attendees);
     $newAttendees = array();
     foreach ($attendees as $attendee) {
         $newAttendees[] = array('userType' => $attendee->user_type == 'group' ? Calendar_Model_Attender::USERTYPE_GROUP : Calendar_Model_Attender::USERTYPE_USER, 'partStat' => Calendar_Model_Attender::STATUS_TENTATIVE, 'role' => Calendar_Model_Attender::ROLE_REQUIRED, 'email' => $attendee->user_type == 'group' ? $attendee->user_id->getId() : $attendee->user_id->email, 'displayName' => $attendee->user_type == 'group' ? $attendee->user_id->name : $attendee->user_id->n_fileas);
     }
     Calendar_Model_Attender::emailsToAttendee($persistentEvent, $newAttendees, TRUE);
     $persistentEvent = Calendar_Controller_Event::getInstance()->update($persistentEvent);
     //var_dump($persistentEvent->attendee->toArray());
     // there must be more than 2 attendees the user, the group + the groupmembers
     $this->assertGreaterThan(2, count($persistentEvent->attendee));
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:23,代码来源:AttenderTests.php


示例14: _recordToJson

 /**
  * returns record prepared for json transport
  *
  * @param Tinebase_Record_Interface $_record
  * @return array record data
  */
 protected function _recordToJson($_record)
 {
     switch (get_class($_record)) {
         case 'Timetracker_Model_Timesheet':
             $_record['timeaccount_id'] = $_record['timeaccount_id'] ? $this->_timeaccountController->get($_record['timeaccount_id']) : $_record['timeaccount_id'];
             $_record['timeaccount_id']['account_grants'] = Timetracker_Model_TimeaccountGrants::getGrantsOfAccount(Tinebase_Core::get('currentAccount'), $_record['timeaccount_id']);
             $_record['timeaccount_id']['account_grants'] = $this->_resolveTimesheetGrantsByTimeaccountGrants($_record['timeaccount_id']['account_grants'], $_record['account_id']);
             Tinebase_User::getInstance()->resolveUsers($_record, 'account_id');
             if (Tinebase_Core::getUser()->hasRight('Sales', 'manage_invoices') && !empty($_record['invoice_id'])) {
                 try {
                     $_record['invoice_id'] = Sales_Controller_Invoice::getInstance()->get($_record['invoice_id']);
                 } catch (Tinebase_Exception_NotFound $nfe) {
                     Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' Could not resolve invoice with id ' . $_record['invoice_id']);
                 }
             }
             $recordArray = parent::_recordToJson($_record);
             break;
         case 'Timetracker_Model_Timeaccount':
             $recordArray = parent::_recordToJson($_record);
             // When editing a single TA we send _ALL_ grants to the client
             $recordArray['grants'] = Timetracker_Model_TimeaccountGrants::getTimeaccountGrants($_record)->toArray();
             foreach ($recordArray['grants'] as &$value) {
                 switch ($value['account_type']) {
                     case Tinebase_Acl_Rights::ACCOUNT_TYPE_USER:
                         $value['account_name'] = Tinebase_User::getInstance()->getUserById($value['account_id'])->toArray();
                         break;
                     case Tinebase_Acl_Rights::ACCOUNT_TYPE_GROUP:
                         $value['account_name'] = Tinebase_Group::getInstance()->getGroupById($value['account_id'])->toArray();
                         break;
                     case Tinebase_Acl_Rights::ACCOUNT_TYPE_ANYONE:
                         $value['account_name'] = array('accountDisplayName' => 'Anyone');
                         break;
                     default:
                         throw new Tinebase_Exception_InvalidArgument('Unsupported accountType.');
                         break;
                 }
             }
             break;
     }
     return $recordArray;
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:47,代码来源:Json.php


示例15: applyAclSql

 /**
  * Applies the requierd params for tags acl to the given select object
  * 
  * @param  Zend_Db_Select $_select
  * @param  string         $_right      required right
  * @param  string         $_idProperty property of tag id in select statement
  * @return void
  */
 public static function applyAclSql($_select, $_right = self::VIEW_RIGHT, $_idProperty = 'id')
 {
     if (empty($_right)) {
         throw new Tinebase_Exception_InvalidArgument('right is empty');
     }
     $db = Tinebase_Core::getDb();
     if ($_idProperty == 'id') {
         $_idProperty = $db->quoteIdentifier('id');
     }
     if (!is_object(Tinebase_Core::getUser())) {
         if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
             Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Cannot apply ACL, no user object found. This might happen during setup/update.');
         }
         return;
     }
     $currentAccountId = Tinebase_Core::getUser()->getId();
     $currentGroupIds = Tinebase_Group::getInstance()->getGroupMemberships($currentAccountId);
     $groupCondition = !empty($currentGroupIds) ? ' OR (' . $db->quoteInto($db->quoteIdentifier('acl.account_type') . ' = ?', Tinebase_Acl_Rights::ACCOUNT_TYPE_GROUP) . ' AND ' . $db->quoteInto($db->quoteIdentifier('acl.account_id') . ' IN (?)', $currentGroupIds) . ' )' : '';
     $where = $db->quoteInto($db->quoteIdentifier('acl.account_type') . ' = ?', Tinebase_Acl_Rights::ACCOUNT_TYPE_ANYONE) . ' OR (' . $db->quoteInto($db->quoteIdentifier('acl.account_type') . ' = ?', Tinebase_Acl_Rights::ACCOUNT_TYPE_USER) . ' AND ' . $db->quoteInto($db->quoteIdentifier('acl.account_id') . ' = ?', $currentAccountId) . ' ) ' . $groupCondition;
     $_select->join(array('acl' => SQL_TABLE_PREFIX . 'tags_acl'), $_idProperty . ' = ' . $db->quoteIdentifier('acl.tag_id'), array())->where($where)->where($db->quoteIdentifier('acl.account_right') . ' = ?', $_right);
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:29,代码来源:TagRight.php


示例16: iterateAddressbookLists

 /**
  * iterate adb lists
  *
  * @param Tinebase_Record_RecordSet $records
  */
 public function iterateAddressbookLists(Tinebase_Record_RecordSet $records)
 {
     $addContactController = Addressbook_Controller_Contact::getInstance();
     $admGroupController = Admin_Controller_Group::getInstance();
     $admUserController = Admin_Controller_User::getInstance();
     $userContactIds = array();
     foreach ($records as $list) {
         if ($list->type == 'group') {
             echo "Skipping list " . $list->name . "\n";
         }
         /**
          * @var Addressbook_Model_List $list
          */
         if (!empty($list->group_id)) {
             continue;
         }
         $group = new Tinebase_Model_Group(array('container_id' => $list->container_id, 'list_id' => $list->getId(), 'name' => $list->name, 'description' => $list->description, 'email' => $list->email));
         $allMembers = array();
         $members = $addContactController->getMultiple($list->members);
         foreach ($members as $member) {
             if ($member->type == Addressbook_Model_Contact::CONTACTTYPE_CONTACT && !in_array($member->getId(), $userContactIds)) {
                 $pwd = Tinebase_Record_Abstract::generateUID();
                 $user = new Tinebase_Model_FullUser(array('accountPrimaryGroup' => Tinebase_Group::getInstance()->getDefaultGroup()->getId(), 'contact_id' => $member->getId(), 'accountDisplayName' => $member->n_fileas ? $member->n_fileas : $member->n_fn, 'accountLastName' => $member->n_family ? $member->n_family : $member->n_fn, 'accountFullName' => $member->n_fn, 'accountFirstName' => $member->n_given ? $member->n_given : '', 'accountEmailAddress' => $member->email), true);
                 $user->accountLoginName = Tinebase_User::getInstance()->generateUserName($user);
                 echo 'Creating user ' . $user->accountLoginName . "...\n";
                 $user = $admUserController->create($user, $pwd, $pwd);
                 $member->account_id = $user->getId();
                 $userContactIds[] = $member->getId();
             }
             $allMembers[] = $member->account_id;
         }
         $group->members = $allMembers;
         echo 'Creating group ' . $group->name . "...\n";
         try {
             $admGroupController->create($group);
         } catch (Exception $e) {
             echo $e->getMessage() . "\n";
         }
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:45,代码来源:Cli.php


示例17: appendFilterSql

 /**
  * appends sql to given select statement
  *
  * @param  Zend_Db_Select                    $_select
  * @param  Tinebase_Backend_Sql_Abstract     $_backend
  */
 public function appendFilterSql($_select, $_backend)
 {
     if ($this->_value === 'all') {
         $_select->where('1=1');
         return;
     }
     $gs = new Tinebase_Backend_Sql_Filter_GroupSelect($_select);
     $adapter = $_backend->getAdapter();
     //if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . ' (' . __LINE__ . ') value: ' . print_r($this->_value, true));
     foreach ($this->_value as $attenderValue) {
         if (in_array($attenderValue['user_type'], array(Calendar_Model_Attender::USERTYPE_USER, Calendar_Model_Attender::USERTYPE_GROUPMEMBER))) {
             // @todo user_id might contain filter in the future -> get userids from adressbook controller with contact filter
             // transform CURRENTCONTACT
             $attenderValue['user_id'] = $attenderValue['user_id'] == Addressbook_Model_Contact::CURRENTCONTACT ? Tinebase_Core::getUser()->contact_id : $attenderValue['user_id'];
             $attendee = array(array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $attenderValue['user_id']), array('user_type' => Calendar_Model_Attender::USERTYPE_GROUPMEMBER, 'user_id' => $attenderValue['user_id']));
         } else {
             if ($attenderValue['user_type'] == self::USERTYPE_MEMBEROF) {
                 // resolve group members
                 $group = Tinebase_Group::getInstance()->getGroupById($attenderValue['user_id']);
                 $attendee = array();
                 // fetch list only if list_id is not NULL, otherwise we get back an empty list object
                 if (!empty($group->list_id)) {
                     $contactList = Addressbook_Controller_List::getInstance()->get($group->list_id);
                     foreach ($contactList->members as $member) {
                         $attendee[] = array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $member);
                         $attendee[] = array('user_type' => Calendar_Model_Attender::USERTYPE_GROUPMEMBER, 'user_id' => $member);
                     }
                 }
             } else {
                 $attendee = array($attenderValue);
             }
         }
         foreach ($attendee as $attender) {
             $gs->orWhere($adapter->quoteInto($adapter->quoteIdentifier('attendee.user_type') . ' = ?', $attender['user_type']) . ' AND ' . $adapter->quoteInto($adapter->quoteIdentifier('attendee.user_id') . ' = ?', $attender['user_id']));
         }
     }
     $gs->appendWhere(Zend_Db_Select::SQL_OR);
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:44,代码来源:AttenderFilter.php


示例18: _deleteGroups

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Tinebase_Helper类代码示例发布时间:2022-05-23
下一篇:
PHP Tinebase_Exception类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap