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


PHP site_object_factory类代码示例

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


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

示例1: array

 function &get_dataset($params = array())
 {
     $request = request::instance();
     if (!($class_id = $request->get_attribute('class_id'))) {
         return new array_dataset();
     }
     $db_table =& db_table_factory::instance('sys_class');
     $class_data = $db_table->get_row_by_id($class_id);
     if (!$class_data) {
         return new array_dataset();
     }
     $c =& site_object_factory::instance($class_data['class_name']);
     $site_object_controller =& $c->get_controller();
     $actions = $site_object_controller->get_actions_definitions();
     $user_groups =& fetch_sub_branch('/root/user_groups', 'user_group', $counter);
     $result = array();
     foreach ($user_groups as $group_id => $group_data) {
         foreach ($actions as $action => $action_params) {
             if (!isset($action_params['can_have_access_template']) || !$action_params['can_have_access_template']) {
                 continue;
             }
             if (isset($action_params['action_name'])) {
                 $result[$group_id]['actions'][$action]['action_name'] = $action_params['action_name'];
             } else {
                 $result[$group_id]['actions'][$action]['action_name'] = str_replace('_', ' ', strtoupper($action[0]) . substr($action, 1));
             }
             $result[$group_id]['group_name'] = $group_data['identifier'];
             $result[$group_id]['actions'][$action]['read_selector_name'] = 'template[' . $action . '][' . $group_id . '][r]';
             $result[$group_id]['actions'][$action]['write_selector_name'] = 'template[' . $action . '][' . $group_id . '][w]';
         }
     }
     return new array_dataset($result);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:33,代码来源:class_group_access_template_datasource.class.php

示例2: _valid_perform

 function _valid_perform()
 {
     $tree =& tree::instance();
     $params = array();
     $params['identifier'] = $this->dataspace->get('identifier');
     $params['parent_path'] = $this->dataspace->get('parent_path');
     $params['class'] = $this->dataspace->get('class_name');
     $params['title'] = $this->dataspace->get('title');
     $object =& site_object_factory::create($params['class']);
     $is_root = false;
     if (!($parent_data = fetch_one_by_path($params['parent_path']))) {
         if ($params['parent_path'] == '/') {
             $is_root = true;
         } else {
             error("parent wasn't retrieved", __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__);
         }
     }
     if (!$is_root) {
         $params['parent_node_id'] = $parent_data['node_id'];
     } else {
         $params['parent_node_id'] = 0;
     }
     $object->import_attributes($params);
     if (!$object->create($is_root)) {
         error("object wasn't registered", __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__);
     }
     if (!$is_root) {
         $parent_object =& site_object_factory::instance($parent_data['class_name']);
         $parent_object->import_attributes($parent_data);
         $access_policy =& access_policy::instance();
         $access_policy->save_object_access($object, $parent_object);
     }
     return new close_popup_response(RESPONSE_STATUS_FORM_SUBMITTED);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:34,代码来源:register_new_object_action.class.php

示例3: array

 function &get_dataset($params = array())
 {
     $request = request::instance();
     if (!($class_id = $request->get_attribute('class_id'))) {
         return new array_dataset();
     }
     $db_table =& db_table_factory::instance('sys_class');
     $class_data = $db_table->get_row_by_id($class_id);
     if (!$class_data) {
         return new array_dataset();
     }
     $c =& site_object_factory::instance($class_data['class_name']);
     $site_object_controller =& $c->get_controller();
     $actions = $site_object_controller->get_actions_definitions();
     $result = array();
     foreach ($actions as $action => $action_params) {
         if (!isset($action_params['can_have_access_template']) || !$action_params['can_have_access_template']) {
             continue;
         }
         if (isset($action_params['action_name'])) {
             $result[$action]['action_name'] = $action_params['action_name'];
         } else {
             $result[$action]['action_name'] = str_replace('_', ' ', strtoupper($action[0]) . substr($action, 1));
         }
     }
     return new array_dataset($result);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:27,代码来源:class_template_actions_list_datasource.class.php

示例4: array

 function &get_dataset($params = array())
 {
     if (!isset($_REQUEST['class_id'])) {
         return new array_dataset();
     }
     $class_id = $_REQUEST['class_id'];
     $db_table =& db_table_factory::instance('sys_class');
     $class_data = $db_table->get_row_by_id($class_id);
     if (!$class_data) {
         return new array_dataset();
     }
     $c =& site_object_factory::instance($class_data['class_name']);
     $site_object_controller =& $c->get_controller();
     $actions = $site_object_controller->get_actions_definitions();
     $user_groups =& fetch_sub_branch('/root/user_groups', 'user_group', $counter);
     $result = array();
     foreach ($actions as $action => $action_params) {
         if (isset($action_params['action_name'])) {
             $result[$action]['action_name'] = $action_params['action_name'];
         } else {
             $result[$action]['action_name'] = str_replace('_', ' ', strtoupper($action[0]) . substr($action, 1));
         }
         $result[$action]['permissions_required'] = $action_params['permissions_required'];
         foreach ($user_groups as $group_id => $group_data) {
             $result[$action]['groups'][$group_id]['selector_name'] = 'policy[' . $group_id . '][' . $action . ']';
         }
     }
     return new array_dataset($result);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:29,代码来源:class_group_action_access_datasource.class.php

示例5: _valid_perform

 function _valid_perform(&$request, &$response)
 {
     $login = $this->dataspace->get('login');
     $password = $this->dataspace->get('password');
     $locale_id = $this->dataspace->get('locale_id');
     $autologin = $this->dataspace->get('autologin');
     $user_object =& site_object_factory::create($this->user_object_class_name);
     if ($user_object->login($login, $password, $locale_id)) {
         if ($autologin) {
             $user =& user::instance();
             $user->configure_autologin();
         }
         $request->set_status(REQUEST_STATUS_FORM_SUBMITTED);
         if ($redirect = $this->dataspace->get('redirect')) {
             $this->_login_redirect($redirect, $response);
             return;
         } elseif (isset($_SERVER['HTTP_REFERER']) && strpos(strtolower($_SERVER['HTTP_REFERER']), '/root/login') === false) {
             $response->redirect($_SERVER['HTTP_REFERER']);
             return;
         } else {
             $response->redirect('/');
             return;
         }
     }
     $request->set_status(REQUEST_STATUS_FAILURE);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:26,代码来源:login_action.class.php

示例6: perform

 function perform(&$request, &$response)
 {
     $request->set_status(REQUEST_STATUS_FAILURE);
     if ($request->has_attribute('popup')) {
         $response->write(close_popup_response($request));
     }
     if (!($id = $request->get_attribute('id'))) {
         return;
     }
     if (!($object_data =& fetch_one_by_node_id((int) $id))) {
         return;
     }
     $object =& site_object_factory::create($object_data['class_name']);
     if (!method_exists($object, 'get_cart_item')) {
         $request->set_status(REQUEST_STATUS_FAILURE);
         return;
     }
     $object->import_attributes($object_data);
     $cart_item =& $object->get_cart_item();
     $cart =& cart::instance();
     if ($quantity = (int) $request->get_attribute('quantity')) {
         $cart_item->set_amount($quantity);
     }
     $cart->add_item($cart_item);
     $request->set_status(REQUEST_STATUS_SUCCESS);
     $response->redirect('/root/cart?popup=1');
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:27,代码来源:add_cart_item_action.class.php

示例7: test_save

  function test_save()
  {
  	$metadata['id'] = 1;
  	$metadata['keywords'] = 'keywords';
  	$metadata['description'] = 'description';
  	
  	$o =& site_object_factory :: create('site_object');
  	
  	$o->import_attributes($metadata);
  	$result_id = $o->save_metadata();
  	
  	$this->assertNotNull($result_id);
  	
  	$sys_metadata_db_table =& db_table_factory :: instance('sys_metadata');
  	$metadata_row = $sys_metadata_db_table->get_row_by_id($result_id);
  	
  	$this->assertTrue(is_array($metadata_row));
  	$this->assertTrue(isset($metadata_row['object_id']));
  	$this->assertTrue(isset($metadata_row['keywords']));
  	$this->assertTrue(isset($metadata_row['description']));

  	$this->assertEqual($metadata_row['object_id'], 1);
  	$this->assertEqual($metadata_row['keywords'], 'keywords');
  	$this->assertEqual($metadata_row['description'], 'description');
	}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:25,代码来源:save_metadata_test.class.php

示例8: _valid_perform

 function _valid_perform(&$request, &$response)
 {
     $tree =& tree::instance();
     $params = array();
     $params['identifier'] = $this->dataspace->get('identifier');
     $params['class'] = $this->dataspace->get('class_name');
     $params['title'] = $this->dataspace->get('title');
     $params['parent_node_id'] = $this->dataspace->get('parent_node_id');
     $params['controller_id'] = site_object_controller::get_id($this->dataspace->get('controller_name'));
     $object =& site_object_factory::create($params['class']);
     if (!($parent_data = fetch_one_by_node_id($params['parent_node_id']))) {
         error("parent wasn't retrieved", __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__);
     }
     $object->merge_attributes($params);
     if (!$object->create()) {
         error("object wasn't registered", __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__);
     }
     $parent_object =& site_object_factory::create($parent_data['class_name']);
     $parent_object->merge_attributes($parent_data);
     $access_policy =& access_policy::instance();
     $access_policy->save_initial_object_access($object, $parent_object);
     $request->set_status(REQUEST_STATUS_FORM_SUBMITTED);
     if ($request->has_attribute('popup')) {
         $response->write(close_popup_response($request));
     }
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:26,代码来源:register_new_object_action.class.php

示例9: get_dataset

	function & get_dataset($params = array())
	{
		if(!isset($_REQUEST['class_id']))
			return new array_dataset();
		
		$class_id = $_REQUEST['class_id'];
		$db_table =& db_table_factory :: instance('sys_class');
		$class_data = $db_table->get_row_by_id($class_id);
		
		if (!$class_data)
			return new array_dataset();

		$c =& site_object_factory :: instance($class_data['class_name']);	
		
		$site_object_controller =& $c->get_controller();
		
		$actions = $site_object_controller->get_actions_definitions();
		
		$result = array();
		foreach($actions as $action => $action_params)
		{
			if (!isset($action_params['can_have_access_template']) || !$action_params['can_have_access_template'])
				continue;

			if(isset($action_params['action_name']))
				$result[$action]['action_name'] = $action_params['action_name'];
			else
				$result[$action]['action_name'] = str_replace('_', ' ', strtoupper($action{0}) . substr($action, 1));				
		}
		
		return new array_dataset($result);
	}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:32,代码来源:class_template_actions_list_datasource.class.php

示例10: elseif

 function &_getSiteObjectTestCase($site_object_class, $tester_postfix = '')
 {
     if ($tester_postfix) {
         $tester_postfix = '_' . $tester_postfix;
     }
     if (file_exists(PROJECT_DIR . '/tests/cases/site_objects_testers/' . $site_object_class . $tester_postfix . '_tester.class.php')) {
         include_once PROJECT_DIR . '/tests/cases/site_objects_testers/' . $site_object_class . $tester_postfix . '_tester.class.php';
         $tester_name = $site_object_class . $tester_postfix . '_tester';
         $test_case =& new $tester_name($site_object_class);
     } elseif (file_exists(LIMB_DIR . '/tests/cases/site_objects_testers/' . $site_object_class . $tester_postfix . '_tester.class.php')) {
         include_once LIMB_DIR . '/tests/cases/site_objects_testers/' . $site_object_class . $tester_postfix . '_tester.class.php';
         $tester_name = $site_object_class . $tester_postfix . '_tester';
         $test_case =& new $tester_name($site_object_class);
     } else {
         $site_object = site_object_factory::create($site_object_class);
         if (is_subclass_of($site_object, 'content_object')) {
             $tester_name = 'content_object' . $tester_postfix . '_tester';
             include_once LIMB_DIR . '/tests/cases/site_objects_testers/' . $tester_name . '.class.php';
             $test_case =& new $tester_name($site_object_class);
         } else {
             $tester_name = 'site_object' . $tester_postfix . '_tester';
             include_once LIMB_DIR . '/tests/cases/site_objects_testers/' . $tester_name . '.class.php';
             $test_case =& new $tester_name($site_object_class);
         }
     }
     return $test_case;
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:27,代码来源:site_objects_test_manager.php

示例11: _valid_perform

 function _valid_perform(&$request, &$response)
 {
     if (!($objects_amounts = $this->dataspace->get('amount'))) {
         $request->set_status(REQUEST_STATUS_FAILURE);
         if ($request->has_attribute('popup')) {
             $response->write(close_popup_response($request));
         }
         return;
     }
     $objects_data =& fetch_by_node_ids(array_keys($objects_amounts), $this->_define_catalog_object(), $counter);
     if (!$objects_data) {
         $request->set_status(REQUEST_STATUS_FAILURE);
         if ($request->has_attribute('popup')) {
             $response->write(close_popup_response($request));
         }
         return;
     }
     $object =& site_object_factory::create($this->_define_catalog_object());
     if (!method_exists($object, 'get_cart_item')) {
         $request->set_status(REQUEST_STATUS_FAILURE);
         if ($request->has_attribute('popup')) {
             $response->write(close_popup_response($request));
         }
         return;
     }
     $cart =& cart::instance();
     foreach ($objects_data as $key => $object_data) {
         $object->import_attributes($object_data);
         $cart_item =& $object->get_cart_item();
         $cart_item->set_amount($objects_amounts[$key]);
         $cart->add_item($cart_item);
     }
     $response->redirect('/root/cart?popup=1');
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:34,代码来源:add_cart_items_action.class.php

示例12: perform

	function perform(&$request, &$response)
	{
		$user_object =& site_object_factory :: create($this->_site_object_name);
		$user_object->logout();
		
		$response->redirect('/');
	}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:7,代码来源:logout_action.class.php

示例13: _valid_perform

 function _valid_perform()
 {
     $object_data =& fetch_mapped_by_url();
     $data = $this->dataspace->export();
     $object =& site_object_factory::create('user_object');
     $object->save_membership($object_data['id'], $data['membership']);
     return new response(RESPONSE_STATUS_FORM_SUBMITTED);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:8,代码来源:set_membership.class.php

示例14: array

 function &get_site_objects()
 {
     $site_objects = array();
     foreach ($this->get_classes_list() as $class) {
         $site_objects[] =& site_object_factory::create($class);
     }
     return $site_objects;
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:8,代码来源:site_objects_loader.class.php

示例15: _valid_perform

 function _valid_perform(&$request, &$response)
 {
     $object_data =& fetch_requested_object($request);
     $data = $this->dataspace->export();
     $object =& site_object_factory::create('user_object');
     $object->save_membership($object_data['id'], $data['membership']);
     $request->set_status(REQUEST_STATUS_FORM_SUBMITTED);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:8,代码来源:set_membership.class.php


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