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


PHP site_object_factory::instance方法代码示例

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


在下文中一共展示了site_object_factory::instance方法的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();
		
		$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

示例5: 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

示例6: _write_create_access_policy

 function _write_create_access_policy()
 {
     $parent_data =& $this->_load_parent_object_data();
     $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($this->object, $parent_object);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:8,代码来源:form_create_site_object_action.class.php

示例7: _write_create_access_policy

 function _write_create_access_policy(&$object)
 {
     $parent_data =& fetch_mapped_by_url();
     $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);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:8,代码来源:form_create_site_object_action.class.php

示例8: _valid_perform

 function _valid_perform(&$request, &$response)
 {
     $user_object =& site_object_factory::instance('user_object');
     $data = $this->dataspace->export();
     if ($user_object->change_own_password($data['password'])) {
         $request->set_status(REQUEST_STATUS_FORM_SUBMITTED);
     } else {
         $request->set_status(REQUEST_STATUS_FAILED);
     }
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:10,代码来源:change_own_password_action.class.php

示例9: _valid_perform

 function _valid_perform()
 {
     $user_object =& site_object_factory::instance('user_object');
     $data = $this->dataspace->export();
     if ($user_object->change_own_password($data['password'])) {
         return new response(RESPONSE_STATUS_FORM_SUBMITTED);
     } else {
         return new failed_response();
     }
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:10,代码来源:change_own_password_action.class.php

示例10: validate

 function validate(&$dataspace)
 {
     $old_password = $dataspace->get($this->field_name);
     $user_site_object =& site_object_factory::instance('user_object');
     if ($user_site_object->validate_password($old_password)) {
         return;
     } else {
         $this->error('WRONG_OLD_PASSWORD');
     }
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:10,代码来源:user_old_password_rule.class.php

示例11: _valid_perform

 function _valid_perform()
 {
     $user_object =& site_object_factory::instance('user_object');
     $data = $this->dataspace->export();
     if (!$user_object->validate_password($data['old_password'])) {
         $error_list =& error_list::instance();
         $error_list->add_error('old_password', 'WRONG_PASSWORD');
         $this->valid = false;
         return $this->valid;
     }
     return $user_object->change_own_password($data['password']);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:12,代码来源:change_own_password_action.class.php

示例12: instance

	function &_get_controller($class_name)
	{
		$site_object =& site_object_factory :: instance($class_name);
		$site_object_controller =& $site_object->get_controller();
		return $site_object_controller;
	}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:6,代码来源:access_policy.class.php

示例13: set_time_limit

require_once LIMB_DIR . '/core/model/search/full_text_indexer.class.php';
require_once LIMB_DIR . '/core/lib/db/db_factory.class.php';
set_time_limit(3000);
$tree =& tree::instance();
$indexer =& new full_text_indexer();
$db =& db_factory::instance();
echo "getting nodes from {$path}...\n";
$nodes =& $tree->get_sub_branch_by_path($path);
echo "nodes retrieved...\n";
$total = sizeof($nodes);
echo 'total nodes count = ' . $total . "...\n";
$counter = 0;
$missed_objects = array();
foreach ($nodes as $node) {
    $db->sql_exec('SELECT sc.class_name FROM sys_site_object sso, sys_class sc 
		WHERE sso.class_id=sc.id AND sso.id=' . $node['object_id']);
    if (!($row = $db->fetch_row())) {
        $missed_objects[] = $node['object_id'];
        continue;
    }
    $site_object =& site_object_factory::instance($row['class_name']);
    $object_data = current($site_object->fetch_by_ids(array($node['object_id'])));
    $site_object->import_attributes($object_data);
    $counter++;
    echo "indexing {$counter} of {$total}...\n";
    $indexer->add($site_object);
}
foreach ($missed_objects as $id) {
    echo "missed object_id: {$id}...\n";
}
echo 'done';
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:31,代码来源:indexer.php

示例14: reset

 function &fetch_one_by_node_id($node_id)
 {
     $tree =& limb_tree::instance();
     if (!($node = $tree->get_node($node_id))) {
         return false;
     }
     $access_policy = access_policy::instance();
     $object_ids = $access_policy->get_accessible_objects(array($node['object_id']));
     if (!count($object_ids)) {
         return false;
     }
     $object_id = reset($object_ids);
     if ($class_name = $this->_get_object_class_name_by_id($object_id)) {
         $site_object =& site_object_factory::instance($class_name);
         $result =& $site_object->fetch_by_ids(array($object_id));
         if (!count($result)) {
             return false;
         }
         $access_policy->assign_actions_to_objects($result);
         $this->_assign_paths($result);
         return reset($result);
     } else {
         return false;
     }
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:25,代码来源:fetcher.class.php

示例15: array

	function & search_fetch_by_ids($object_ids, $loader_class_name, &$counter, $params = array(), $fetch_method = 'fetch_by_ids')
	{
		if (!$this->_query_object)
		{
			 debug :: write_error('search_query is empty',
    		 __FILE__ . ' : ' . __LINE__ . ' : ' .  __FUNCTION__, 
    		array()
    	);
    	return array();
    }	

		$search =& new full_text_search();
		$search_result = $search->find_by_ids($object_ids, $this->_query_object);

		if(!count($search_result))
			return array();
		
		$counter = 0;
		$count_method = $fetch_method . '_count';
		
		$site_object =& site_object_factory :: instance($loader_class_name);
		$counter = $site_object->$count_method(array_keys($search_result), $params);
		$fetched_objects =& $site_object->$fetch_method(array_keys($search_result),$params);

		if(!count($fetched_objects))
			return array();
		
		foreach($search_result as $key => $score)
			if (isset($fetched_objects[$key]))
			{
				$result[$key] = $fetched_objects[$key];
				$result[$key]['score'] = $score;
			}	
		
		$access_policy = access_policy :: instance();
		$access_policy->assign_actions_to_objects($result);

		$this->_assign_paths($result);
		$this->_assign_search_paths($result, isset($params['offset']) ? $params['offset'] : 0);
		
		return $result;
	}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:42,代码来源:search_fetcher.class.php


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