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


PHP Space类代码示例

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


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

示例1: Search

 function Search($firstcount, $displaypg)
 {
     global $cache_types;
     uses("space", "industry", "area");
     $space = new Space();
     $area = new Areas();
     $industry = new Industries();
     $cache_options = cache_read('typeoption');
     $area_s = $space->array_multi2single($area->getCacheArea());
     $industry_s = $space->array_multi2single($area->getCacheArea());
     $result = $this->findAll("*,name AS title,content AS digest", null, null, $this->orderby, $firstcount, $displaypg);
     while (list($keys, $values) = each($result)) {
         $result[$keys]['typename'] = $cache_types['productsort'][$values['sort_id']];
         $result[$keys]['thumb'] = pb_get_attachmenturl($values['picture'], '', 'small');
         $result[$keys]['pubdate'] = df($values['begin_time']);
         if (!empty($result[$keys]['area_id'])) {
             $r1 = $area_s[$result[$keys]['area_id']];
         }
         if (!empty($result[$keys]['cache_companyname'])) {
             $r2 = "<a href='" . $space->rewrite($result[$keys]['cache_companyname'], $result[$keys]['company_id']) . "'>" . $result[$keys]['cache_companyname'] . "</a>";
         }
         if (!empty($r1) || !empty($r2)) {
             $result[$keys]['extra'] = implode(" - ", array($r1, $r2));
         }
         $result[$keys]['url'] = $this->getPermaLink($values['id']);
     }
     return $result;
 }
开发者ID:renduples,项目名称:alibtob,代码行数:28,代码来源:product.php

示例2: run

 /**
  * Runs the Widget
  */
 public function run()
 {
     // Possible Security Flaw: Check type!
     $type = $this->activity->type;
     $underlyingObject = $this->activity->getUnderlyingObject();
     // Try to figure out wallEntryId of this activity
     $wallEntryId = 0;
     if ($underlyingObject != null) {
         if ($underlyingObject instanceof HActiveRecordContent || $underlyingObject instanceof HActiveRecordContentAddon) {
             $wallEntryId = $underlyingObject->content->getFirstWallEntryId();
         }
     }
     // When element is assigned to a workspace, assign variable
     $workspace = null;
     if ($this->activity->content->space_id != "") {
         $workspace = Space::model()->findByPk($this->activity->content->space_id);
     }
     // User that fired the activity
     $user = $this->activity->content->user;
     if ($user == null) {
         Yii::log("Skipping activity without valid user", "warning");
         return;
     }
     // Dertermine View
     $view = "";
     if ($this->activity->module == "") {
         $view = 'application.modules_core.activity.views.activities.' . $this->activity->type;
     } else {
         $view = $this->activity->module . '.views.activities.' . $this->activity->type;
     }
     // Activity Layout can access it
     $this->wallEntryId = $wallEntryId;
     $this->render($view, array('activity' => $this->activity, 'wallEntryId' => $wallEntryId, 'user' => $user, 'target' => $underlyingObject, 'workspace' => $workspace));
 }
开发者ID:alefernie,项目名称:intranet,代码行数:37,代码来源:ActivityWidget.php

示例3: actionAssignAllMembers

 public function actionAssignAllMembers($args)
 {
     if (!isset($args[0])) {
         print "Error: Space guid parameter required!\n\n";
         print $this->getHelp();
         return;
     }
     $space = Space::model()->findByAttributes(array('guid' => $args[0]));
     if ($space == null) {
         print "Error: Space not found! Check guid!\n\n";
         return;
     }
     $countMembers = 0;
     $countAssigns = 0;
     foreach (User::model()->findAllByAttributes(array('status' => User::STATUS_ENABLED)) as $user) {
         if ($space->isMember($user->id)) {
             #print "Already Member!";
             $countMembers++;
         } else {
             print "Add member " . $user->displayName . "\n";
             Yii::app()->user->setId($user->id);
             $space->addMember($user->id);
             $countAssigns++;
         }
     }
     print "\nAdded " . $countAssigns . " new members to space " . $space->name . "\n";
 }
开发者ID:alefernie,项目名称:intranet,代码行数:27,代码来源:SpaceCliTool.php

示例4: jsonSerialize

 /**
  * Returns an object to be used by `json_encode` to serialize objects of this class.
  *
  * @return object
  *
  * @see http://php.net/manual/en/jsonserializable.jsonserialize.php JsonSerializable::jsonSerialize
  */
 public function jsonSerialize()
 {
     $obj = new \stdClass();
     if ($this->id !== null) {
         $obj->id = $this->id;
     }
     if ($this->type !== null) {
         $obj->type = $this->type;
     }
     if ($this->space !== null) {
         $obj->space = (object) ['sys' => (object) ['type' => 'Link', 'linkType' => 'Space', 'id' => $this->space->getId()]];
     }
     if ($this->contentType !== null) {
         $obj->contentType = (object) ['sys' => (object) ['type' => 'Link', 'linkType' => 'ContentType', 'id' => $this->contentType->getId()]];
     }
     if ($this->revision !== null) {
         $obj->revision = $this->revision;
     }
     if ($this->createdAt !== null) {
         $obj->createdAt = $this->formatDateForJson($this->createdAt);
     }
     if ($this->updatedAt !== null) {
         $obj->updatedAt = $this->formatDateForJson($this->updatedAt);
     }
     if ($this->deletedAt !== null) {
         $obj->deletedAt = $this->formatDateForJson($this->deletedAt);
     }
     return $obj;
 }
开发者ID:andrewevansmith,项目名称:contentful.php,代码行数:36,代码来源:SystemProperties.php

示例5: register

 public function register(array $input = array())
 {
     $customrules = ['email' => 'required|email|unique:user,email'];
     $input['type'] = isset($input['type']) ? $input['type'] : 'user';
     $input['via'] = isset($input['via']) ? $input['via'] : 'register';
     $input['signup_ref'] = isset($input['signup_ref']) ? $input['signup_ref'] : null;
     $input['ref_code'] = $this->_refCodeGenerator();
     $validation = $this->model->validate($input, $customrules);
     if ($validation->passes()) {
         $user = $this->model->create($input);
         $this->_sendWelcomeMail($input);
         if ($input['signup_ref'] != null) {
             \Space::create(['user_id' => $user->id, 'type' => 'credit', 'nominal' => \Config::get('thankspace.space_credit.signup'), 'keterangan' => 'Space Credit for sign up from link referral']);
         }
         $this->_sendAdminNewCustomerMail($user->id);
         if ($input['via'] != 'admin') {
             $auth = $this->_handleLogin($user->id);
             return $auth;
         } else {
             return true;
         }
     } else {
         $this->setErrors($validation->messages()->all(':message'));
         return false;
     }
 }
开发者ID:rizalafani,项目名称:thankspace,代码行数:26,代码来源:UserRepo.php

示例6: run

 /**
  * Executes the widgets
  */
 public function run()
 {
     $statsCountSpaces = Space::model()->count();
     $statsCountSpacesHidden = Space::model()->countByAttributes(array('visibility' => Space::VISIBILITY_NONE));
     $statsSpaceMostMembers = Space::model()->find('id = (SELECT space_id  FROM space_membership GROUP BY space_id ORDER BY count(*) DESC LIMIT 1)');
     // Render widgets view
     $this->render('spaceStats', array('statsSpaceMostMembers' => $statsSpaceMostMembers, 'statsCountSpaces' => $statsCountSpaces, 'statsCountSpacesHidden' => $statsCountSpacesHidden));
 }
开发者ID:skapl,项目名称:design,代码行数:11,代码来源:SpaceStatisticsWidget.php

示例7: onSearchRebuild

 /**
  * On rebuild of the search index, rebuild all space records
  *
  * @param type $event
  */
 public static function onSearchRebuild($event)
 {
     foreach (Space::model()->findAll() as $obj) {
         if ($obj->visibility != Space::VISIBILITY_NONE) {
             HSearch::getInstance()->addModel($obj);
         }
         print "s";
     }
 }
开发者ID:alefernie,项目名称:intranet,代码行数:14,代码来源:SpaceModule.php

示例8: run

 /**
  * Executes the widgets
  */
 public function run()
 {
     $criteria = new CDbCriteria();
     $criteria->join = 'LEFT JOIN space_membership ON t.id=space_membership.space_id AND space_membership.user_id=:userId';
     $criteria->condition = 't.visibility != :visibilityNone OR space_membership.status = :statusMember';
     $criteria->params = array(':userId' => Yii::app()->user->id, ':visibilityNone' => Space::VISIBILITY_NONE, ':statusMember' => SpaceMembership::STATUS_MEMBER);
     $newSpaces = Space::model()->active()->recently(10)->findAll($criteria);
     $this->render('newSpaces', array('newSpaces' => $newSpaces, 'showMoreButton' => $this->showMoreButton));
 }
开发者ID:skapl,项目名称:design,代码行数:12,代码来源:NewSpacesWidget.php

示例9: actionIndex

 /**
  * Returns a List of Users
  */
 public function actionIndex()
 {
     Yii::import('admin.forms.*');
     $form = new BasicSettingsForm();
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'basic-settings-form') {
         echo CActiveForm::validate($form);
         Yii::app()->end();
     }
     if (isset($_POST['BasicSettingsForm'])) {
         $_POST['BasicSettingsForm'] = Yii::app()->input->stripClean($_POST['BasicSettingsForm']);
         $form->attributes = $_POST['BasicSettingsForm'];
         if ($form->validate()) {
             HSetting::Set('name', $form->name);
             HSetting::Set('baseUrl', $form->baseUrl);
             HSetting::Set('defaultLanguage', $form->defaultLanguage);
             HSetting::Set('enable', $form->tour, 'tour');
             $spaceGuids = explode(",", $form->defaultSpaceGuid);
             // Remove Old Default Spaces
             foreach (Space::model()->findAllByAttributes(array('auto_add_new_members' => 1)) as $space) {
                 if (!in_array($space->guid, $spaceGuids)) {
                     $space->auto_add_new_members = 0;
                     $space->save();
                 }
             }
             // Add new Default Spaces
             foreach ($spaceGuids as $spaceGuid) {
                 $space = Space::model()->findByAttributes(array('guid' => $spaceGuid));
                 if ($space != null && $space->auto_add_new_members != 1) {
                     $space->auto_add_new_members = 1;
                     $space->save();
                 }
             }
             // set flash message
             Yii::app()->user->setFlash('data-saved', Yii::t('AdminModule.controllers_SettingController', 'Saved'));
             $this->redirect(Yii::app()->createUrl('//admin/setting/index'));
         }
     } else {
         $form->name = HSetting::Get('name');
         $form->baseUrl = HSetting::Get('baseUrl');
         $form->defaultLanguage = HSetting::Get('defaultLanguage');
         $form->tour = HSetting::Get('enable', 'tour');
         $form->defaultSpaceGuid = "";
         foreach (Space::model()->findAllByAttributes(array('auto_add_new_members' => 1)) as $defaultSpace) {
             $form->defaultSpaceGuid .= $defaultSpace->guid . ",";
         }
     }
     $this->render('index', array('model' => $form));
     /*
      Yii::app()->interceptor->preattachEventHandler('SuperAdminNavigationWidget', 'onInit', function($event) {
      $event->sender->addItem(array(
      'label' => 'Item Dynamic Inject Test',
      'url' => Yii::app()->createUrl('')
      ));
      });
     */
 }
开发者ID:ahdail,项目名称:humhub,代码行数:59,代码来源:SettingController.php

示例10: select

 /**
  * ユーザ・グループ検索機能を提供します
  *
  * @param string $title 項目名として表示させる文字列
  * @param string $pluginModel モデル名
  * @param int $roomId ルームID
  * @param array $selectUsers 選択済みユーザ配列
  * @return string HTML tags
  */
 public function select($title = '', $pluginModel = 'GroupsUser', $roomId = null, $selectUsers = array())
 {
     if (!isset($roomId)) {
         $roomId = Space::getRoomIdRoot(Space::COMMUNITY_SPACE_ID);
     }
     if ($title === '') {
         $title = __d('groups', 'User select');
     }
     return $this->_View->element('Groups.select', array('title' => $title, 'pluginModel' => $pluginModel, 'roomId' => $roomId, 'selectUsers' => $selectUsers));
 }
开发者ID:s-nakajima,项目名称:Groups,代码行数:19,代码来源:GroupUserListHelper.php

示例11: testGet

 public function testGet()
 {
     $this->assertEquals(SpaceSetting::Get(1, 'globalSetting', 'core'), 'xyz');
     $this->assertEquals(SpaceSetting::Get(1, 'globalSetting'), 'xyz');
     $this->assertEquals(SpaceSetting::Get(1, 'moduleSetting', 'someModule'), 'zyx');
     $space = Space::model()->findByPk(1);
     $this->assertEquals($space->getSetting('globalSetting', 'core'), 'xyz');
     $this->assertEquals($space->getSetting('globalSetting'), 'xyz');
     $this->assertEquals($space->getSetting('moduleSetting', 'someModule'), 'zyx');
 }
开发者ID:alefernie,项目名称:intranet,代码行数:10,代码来源:SpaceSettingTest.php

示例12: registerUser

 /** 
  * Registers a user
  * @param array data
  */
 private function registerUser($data)
 {
     $userModel = new User('register');
     $userPasswordModel = new UserPassword();
     $profileModel = $userModel->profile;
     $profileModel->scenario = 'register';
     // User: Set values
     $userModel->username = $data['username'];
     $userModel->email = $data['email'];
     $userModel->group_id = $data['group_id'];
     $userModel->status = User::STATUS_ENABLED;
     // Profile: Set values
     $profileModel->firstname = $data['firstname'];
     $profileModel->lastname = $data['lastname'];
     // Password: Set values
     $userPasswordModel->setPassword($data['password']);
     if ($userModel->save()) {
         // Save user profile
         $profileModel->user_id = $userModel->id;
         $profileModel->save();
         // Save user password
         $userPasswordModel->user_id = $userModel->id;
         $userPasswordModel->save();
         // Join space / create then join space
         foreach ($data['space_names'] as $key => $space_name) {
             // Find space by name attribute
             $space = Space::model()->findByAttributes(array('name' => $space_name));
             // Create the space if not found
             if ($space == null) {
                 $space = new Space();
                 $space->name = $space_name;
                 $space->save();
             }
             // Add member into space
             $space->addMember($userModel->id);
         }
         return true;
     } else {
         Yii::app()->user->setFlash('error', CHtml::errorSummary($userModel));
         return false;
     }
 }
开发者ID:nsystem1,项目名称:humhub-modules-bulk_import,代码行数:46,代码来源:MainController.php

示例13: testGetFollowers

 public function testGetFollowers()
 {
     $space = Space::model()->findByPk(3);
     $space->follow(1);
     $space->follow(2);
     $space->follow(3);
     $users = $space->getFollowers();
     $userIds = array_map(create_function('$user', 'return $user->id;'), $users);
     sort($userIds);
     $this->assertEquals(array(1, 2, 3), $userIds);
 }
开发者ID:alefernie,项目名称:intranet,代码行数:11,代码来源:HFollowableBehaviorTest.php

示例14: actionSearchJson

 /**
  * Returns a workspace list by json
  *
  * It can be filtered by by keyword.
  */
 public function actionSearchJson()
 {
     $keyword = Yii::app()->request->getParam('keyword', "");
     // guid of user/workspace
     $page = (int) Yii::app()->request->getParam('page', 1);
     // current page (pagination)
     $limit = (int) Yii::app()->request->getParam('limit', HSetting::Get('paginationSize'));
     // current page (pagination)
     $keyword = Yii::app()->input->stripClean($keyword);
     $hitCount = 0;
     $query = "model:Space ";
     if (strlen($keyword) > 2) {
         // Include Keyword
         if (strpos($keyword, "@") === false) {
             $keyword = str_replace(".", "", $keyword);
             $query .= "AND (title:" . $keyword . "* OR tags:" . $keyword . "*)";
         }
     }
     //, $limit, $page
     $hits = new ArrayObject(HSearch::getInstance()->Find($query));
     $hitCount = count($hits);
     // Limit Hits
     $hits = new LimitIterator($hits->getIterator(), ($page - 1) * $limit, $limit);
     $json = array();
     #$json['totalHits'] = $hitCount;
     #$json['limit'] = $limit;
     #$results = array();
     foreach ($hits as $hit) {
         $doc = $hit->getDocument();
         $model = $doc->getField("model")->value;
         if ($model == "Space") {
             $workspaceId = $doc->getField('pk')->value;
             $workspace = Space::model()->findByPk($workspaceId);
             if ($workspace != null) {
                 $wsInfo = array();
                 $wsInfo['guid'] = $workspace->guid;
                 $wsInfo['title'] = CHtml::encode($workspace->name);
                 $wsInfo['tags'] = CHtml::encode($workspace->tags);
                 $wsInfo['image'] = $workspace->getProfileImage()->getUrl();
                 $wsInfo['link'] = $workspace->getUrl();
                 #$results[] = $wsInfo;
                 $json[] = $wsInfo;
             } else {
                 Yii::log("Could not load workspace with id " . $userId . " from search index!", CLogger::LEVEL_ERROR);
             }
         } else {
             Yii::log("Got no workspace hit from search index!", CLogger::LEVEL_ERROR);
         }
     }
     #$json['results'] = $results;
     print CJSON::encode($json);
     Yii::app()->end();
 }
开发者ID:alefernie,项目名称:intranet,代码行数:58,代码来源:BrowseController.php

示例15: checkSpaceGuid

 /**
  * This validator function checks the defaultSpaceGuid.
  *
  * @param type $attribute
  * @param type $params
  */
 public function checkSpaceGuid($attribute, $params)
 {
     if ($this->defaultSpaceGuid != "") {
         foreach (explode(',', $this->defaultSpaceGuid) as $spaceGuid) {
             if ($spaceGuid != "") {
                 $space = Space::model()->findByAttributes(array('guid' => $spaceGuid));
                 if ($space == null) {
                     $this->addError($attribute, Yii::t('AdminModule.forms_BasicSettingsForm', "Invalid space"));
                 }
             }
         }
     }
 }
开发者ID:ahdail,项目名称:humhub,代码行数:19,代码来源:BasicSettingsForm.php


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