本文整理汇总了PHP中midcom_helper_datamanager2_schema::load_database方法的典型用法代码示例。如果您正苦于以下问题:PHP midcom_helper_datamanager2_schema::load_database方法的具体用法?PHP midcom_helper_datamanager2_schema::load_database怎么用?PHP midcom_helper_datamanager2_schema::load_database使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类midcom_helper_datamanager2_schema
的用法示例。
在下文中一共展示了midcom_helper_datamanager2_schema::load_database方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _handler_edit
/**
* Handle the editing phase
*
* @param String $handler_id Name of the request handler
* @param array $args Variable arguments
* @param array &$data Public request data, passed by reference
*/
public function _handler_edit($handler_id, array $args, array &$data)
{
// Get the event
$this->_event = new org_openpsa_calendar_event_dba($args[0]);
$this->_event->require_do('midgard:update');
// Load schema database
$schemadb = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb'));
// Load the controller
$data['controller'] = midcom_helper_datamanager2_controller::create('simple');
$data['controller']->schemadb = $schemadb;
$data['controller']->set_storage($this->_event);
if (!$data['controller']->initialize()) {
throw new midcom_error("Failed to initialize a DM2 controller instance for article {$this->_article->id}.");
}
switch ($data['controller']->process_form()) {
case 'save':
$indexer = new org_openpsa_calendar_midcom_indexer($this->_topic);
$indexer->index($data['controller']->datamanager);
//FALL-THROUGH
//FALL-THROUGH
case 'cancel':
midcom::get('head')->add_jsonload('window.opener.location.reload();');
midcom::get('head')->add_jsonload('window.close();');
// This will _midcom_stop_request(well, in a way...)
}
// Add toolbar items
org_openpsa_helpers::dm2_savecancel($this);
}
示例2: _load_datamanager
private function _load_datamanager()
{
$schemadb_person = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_person'));
$this->_datamanager = new midcom_helper_datamanager2_datamanager($schemadb_person);
$this->_datamanager->set_schema($this->_master->get_person_schema($this->_contact));
$this->_datamanager->set_storage($this->_contact);
}
示例3: _load_controller
/**
* Load either a create controller or an edit (simple) controller or trigger an error message
*/
private function _load_controller()
{
// Get the configured schemas
$schemadbs = $this->_config->get('schemadbs_folder');
// Check if a custom schema exists
if (array_key_exists($this->_topic->component, $schemadbs)) {
$schemadb = $schemadbs[$this->_topic->component];
} else {
if (!array_key_exists('default', $schemadbs)) {
throw new midcom_error('Configuration error. No default schema for topic has been defined!');
}
$schemadb = $schemadbs['default'];
}
$GLOBALS['midcom_admin_folder_mode'] = $this->_handler_id;
// Create the schema instance
$this->_schemadb = midcom_helper_datamanager2_schema::load_database($schemadb);
switch ($this->_handler_id) {
case 'edit':
$this->_controller = midcom_helper_datamanager2_controller::create('simple');
$this->_controller->schemadb =& $this->_schemadb;
$this->_controller->set_storage($this->_topic);
break;
case 'create':
foreach ($this->_schemadb as $schema) {
if (isset($schema->fields['name'])) {
$schema->fields['name']['required'] = 0;
}
}
$this->_controller = midcom_helper_datamanager2_controller::create('create');
$this->_controller->schemadb =& $this->_schemadb;
$this->_controller->schemaname = 'default';
$this->_controller->callback_object =& $this;
// Suggest to create the same type of a folder as the parent is
$component_suggestion = $this->_topic->component;
//Unless config told us otherwise
if ($this->_config->get('default_component')) {
$component_suggestion = $this->_config->get('default_component');
}
$this->_controller->defaults = array('component' => $component_suggestion);
break;
case 'createlink':
if (!array_key_exists('link', $schemadbs)) {
throw new midcom_error('Configuration error. No link schema for topic has been defined!');
}
$schemadb = $schemadbs['link'];
// Create the schema instance
$this->_schemadb = midcom_helper_datamanager2_schema::load_database($schemadb);
$this->_schemadb->default->fields['name']['required'] = 0;
$this->_controller = midcom_helper_datamanager2_controller::create('create');
$this->_controller->schemadb =& $this->_schemadb;
$this->_controller->schemaname = 'link';
$this->_controller->callback_object =& $this;
break;
default:
throw new midcom_error('Unable to process the request, unknown handler id');
}
if (!$this->_controller->initialize()) {
throw new midcom_error("Failed to initialize a DM2 controller instance for article {$this->_event->id}.");
}
}
示例4: load_schemadb
/**
* Loads and prepares the schema database.
*
* The operations are done on all available schemas within the DB.
*/
public function load_schemadb()
{
$schemadb = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_acl'));
$fields =& $schemadb['default']->fields;
$group_object = midcom::get('auth')->get_group("group:{$this->_request_data['group']->guid}");
// Get the calendar root event
$root_event = org_openpsa_calendar_interface::find_root_event();
if (is_object($root_event)) {
$fields['calendar']['privilege_object'] = $root_event;
$fields['calendar']['privilege_assignee'] = $group_object->id;
} else {
if (isset($fields['calendar'])) {
unset($fields['calendar']);
}
}
// Set the group into ACL
$fields['contact_creation']['privilege_object'] = $group_object->get_storage();
$fields['contact_editing']['privilege_object'] = $group_object->get_storage();
$fields['organization_creation']['privilege_object'] = $group_object->get_storage();
$fields['organization_editing']['privilege_object'] = $group_object->get_storage();
$fields['projects']['privilege_object'] = $group_object->get_storage();
$fields['invoices_creation']['privilege_object'] = $group_object->get_storage();
$fields['invoices_editing']['privilege_object'] = $group_object->get_storage();
// Load campaign classes
if (midcom::get('componentloader')->load_graceful('org.openpsa.directmarketing')) {
$fields['campaigns_creation']['privilege_object'] = $group_object->get_storage();
$fields['campaigns_editing']['privilege_object'] = $group_object->get_storage();
} else {
unset($fields['campaigns_creation']);
unset($fields['campaigns_editing']);
}
$fields['salesproject_creation']['privilege_object'] = $group_object->get_storage();
return $schemadb;
}
示例5: _show_list
/**
*
* @param mixed $handler_id The ID of the handler.
* @param array &$data The local request data.
*/
public function _show_list($handler_id, array &$data)
{
if ($handler_id == 'mycontacts_xml') {
$schemadb_person = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_person'));
$datamanager = new midcom_helper_datamanager2_datamanager($schemadb_person);
$xml = '<contacts></contacts>';
$simplexml = simplexml_load_string($xml);
foreach ($data['mycontacts'] as $person) {
$contact = $simplexml->addChild('contact');
$contact->addAttribute('guid', $person->guid);
$datamanager->autoset_storage($person);
$person_data = $datamanager->get_content_xml();
foreach ($person_data as $key => $value) {
$contact->addChild($key, $value);
}
$mc = midcom_db_member::new_collector('uid', $person->id);
$memberships = $mc->get_values('gid');
$qb = org_openpsa_contacts_group_dba::new_query_builder();
$qb->add_constraint('gid', 'IN', $memberships);
$qb->add_constraint('orgOpenpsaObtype', '>', org_openpsa_contacts_list_dba::MYCONTACTS);
$organisations = $qb->execute();
foreach ($organisations as $organisation) {
$contact->addChild('company', str_replace('&', '&', ${$organisation}->get_label()));
}
}
echo $simplexml->asXml();
} else {
midcom_show_style("show-mycontacts-header");
foreach ($data['mycontacts'] as $person) {
$data['person'] = $person;
midcom_show_style("show-mycontacts-item");
}
midcom_show_style("show-mycontacts-footer");
}
}
示例6: _on_reindex
/**
* Iterate over all articles and create index record using the datamanager indexer
* method.
*/
public function _on_reindex($topic, $config, &$indexer)
{
if (is_null($config->get('symlink_topic')) && !$config->get('disable_indexing')) {
$qb = midcom::get('dbfactory')->new_query_builder('midcom_db_article');
$qb->add_constraint('topic', '=', $topic->id);
$result = $qb->execute();
if ($result) {
$schemadb = midcom_helper_datamanager2_schema::load_database($config->get('schemadb'));
$datamanager = new midcom_helper_datamanager2_datamanager($schemadb);
if (!$datamanager) {
debug_add('Warning, failed to create a datamanager instance with this schemapath:' . $config->get('schemadb'), MIDCOM_LOG_WARN);
continue;
}
foreach ($result as $article) {
if (!$datamanager->autoset_storage($article)) {
debug_add("Warning, failed to initialize datamanager for Article {$article->id}. Skipping it.", MIDCOM_LOG_WARN);
continue;
}
net_nehmer_blog_viewer::index($datamanager, $indexer, $topic);
}
}
} elseif (is_null($config->get('symlink_topic')) && !$config->get('disable_search')) {
debug_add("The topic {$topic->id} is is not to be indexed, skipping indexing.");
} else {
debug_add("The topic {$topic->id} is symlinked to another topic, skipping indexing.");
}
return true;
}
示例7: __construct
public function __construct($object = null)
{
$this->_object = $object;
$schemadb_raw = array('default' => array('description' => __CLASS__ . ' testcase schema', 'fields' => array()));
$this->_schemadb = midcom_helper_datamanager2_schema::load_database($schemadb_raw);
if ($this->_object) {
if (!empty($this->_object->id)) {
$controller_type = 'simple';
} else {
$controller_type = 'create';
}
} else {
$controller_type = 'nullstorage';
}
$this->_controller = midcom_helper_datamanager2_controller::create($controller_type);
$this->_controller->schemaname = 'default';
$this->_controller->schemadb =& $this->_schemadb;
switch ($controller_type) {
case 'create':
$this->_controller->callback_object =& $this;
case 'nullstorage':
$this->_controller->defaults =& $this->defaults;
break;
}
}
示例8: _on_initialize
/**
* Initialization of the handler class
*/
public function _on_initialize()
{
org_openpsa_widgets_calendar::add_head_elements();
// Load schema database
$schemadb = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb'));
$this->_datamanager = new midcom_helper_datamanager2_datamanager($schemadb);
$this->_root_event = org_openpsa_calendar_interface::find_root_event();
}
示例9: _on_reindex
/**
* Prepare the indexer client
*/
public function _on_reindex($topic, $config, &$indexer)
{
$qb = org_openpsa_invoices_invoice_dba::new_query_builder();
$schemadb = midcom_helper_datamanager2_schema::load_database($config->get('schemadb'));
$indexer = new org_openpsa_invoices_midcom_indexer($topic, $indexer);
$indexer->add_query('invoices', $qb, $schemadb);
return $indexer;
}
示例10: load_schemadb
public function load_schemadb()
{
$schemadb = midcom_helper_datamanager2_schema::load_database($GLOBALS['midcom_config']['metadata_schema']);
if ($this->_config->get('enable_review_dates') && !isset($schemadb['metadata']->fields['review_date'])) {
$schemadb['metadata']->append_field('review_date', array('title' => $this->_l10n->get('review date'), 'type' => 'date', 'type_config' => array('storage_type' => 'UNIXTIME'), 'storage' => array('location' => 'parameter', 'domain' => 'midcom.helper.metadata', 'name' => 'review_date'), 'widget' => 'jsdate'));
}
return $schemadb;
}
示例11: _load_schemadb
/**
* Load the schmadb used in forms
*/
public function _load_schemadb()
{
$this->_request_data['schemadb_suggestion'] = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_suggestion'));
if (!$_MIDCOM->auth->user && $this->_config->get('use_captcha')) {
$this->_request_data['schemadb_suggestion']['default']->append_field('captcha', array('title' => $this->_l10n_midcom->get('captcha field title'), 'storage' => null, 'type' => 'captcha', 'widget' => 'captcha', 'widget_config' => $this->_config->get('captcha_config')));
}
$this->_schemadb =& $this->_request_data['schemadb_suggestion'];
}
示例12: _load_controller
private function _load_controller()
{
$this->_request_data['schemadb_salesproject'] = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_salesproject'));
$this->_request_data['schemadb_salesproject_deliverable'] = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_deliverable'));
$this->_request_data['controller'] = midcom_helper_datamanager2_controller::create('ajax');
$this->_request_data['controller']->schemadb =& $this->_request_data['schemadb_salesproject'];
$this->_request_data['controller']->set_storage($this->_salesproject);
$this->_request_data['controller']->process_ajax();
}
示例13: _initialize_datamanager
private function _initialize_datamanager($schemadb_snippet)
{
// Initialize the datamanager with the schema
$this->_schemadb = midcom_helper_datamanager2_schema::load_database($schemadb_snippet);
$this->_datamanager = new midcom_helper_datamanager2_datamanager($this->_schemadb);
if (!$this->_datamanager) {
throw new midcom_error("Datamanager could not be instantiated.");
}
}
示例14: _load_schemadb
function _load_schemadb($handler_id, &$args, &$data)
{
//We need the constants...
midcom::get('componentloader')->load('org.openpsa.projects');
if (isset($_GET['filename']) && is_string($_GET['filename']) && strpos($_GET['filename'], '.csv')) {
$data['filename'] = $_GET['filename'];
}
return midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_hours'));
}
示例15: __construct
public function __construct($schemadb = null)
{
parent::__construct();
if (null === $schemadb) {
$this->_schemadb = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_formmailer'));
} else {
$this->_schemadb = $schemadb;
}
}