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


PHP midcom::get方法代码示例

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


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

示例1: test_handler_delete

 public function test_handler_delete()
 {
     midcom::get('auth')->request_sudo('org.openpsa.user');
     $data = $this->run_handler('org.openpsa.user', array('delete', self::$_user->guid));
     $this->assertEquals('user_delete', $data['handler_id']);
     midcom::get('auth')->drop_sudo();
 }
开发者ID:nemein,项目名称:openpsa,代码行数:7,代码来源:deleteTest.php

示例2: testHandler_render

 public function testHandler_render()
 {
     midcom::get('auth')->request_sudo('org.openpsa.relatedto');
     $data = $this->run_handler('org.openpsa.invoices', array('__mfa', 'org.openpsa.relatedto', 'render', self::$_object_from->guid, 'both'));
     $this->assertEquals('____mfa-org.openpsa.relatedto-render', $data['handler_id']);
     midcom::get('auth')->drop_sudo();
 }
开发者ID:nemein,项目名称:openpsa,代码行数:7,代码来源:relatedtoTest.php

示例3: test_handler_json

 public function test_handler_json()
 {
     midcom::get('auth')->request_sudo('org.openpsa.user');
     $data = $this->run_handler('org.openpsa.user', array('json'));
     $this->assertEquals('user_list_json', $data['handler_id']);
     midcom::get('auth')->drop_sudo();
 }
开发者ID:nemein,项目名称:openpsa,代码行数:7,代码来源:listTest.php

示例4: reopen_account

 /**
  * Function to unblock an account after too many failed to login attempts
  *
  * @param array $args Contains the guid, parameter & parameter names to get username&password
  */
 function reopen_account($args, &$handler)
 {
     midcom::get('auth')->request_sudo($this->_component);
     try {
         $person = new midcom_db_person($args['guid']);
     } catch (midcom_error $e) {
         $msg = 'Person with guid #' . $args['guid'] . ' does not exist';
         debug_add($msg, MIDCOM_LOG_ERROR);
         $handler->print_error($msg);
         midcom::get('auth')->drop_sudo();
         return false;
     }
     $accounthelper = new org_openpsa_user_accounthelper($person);
     try {
         $accounthelper->reopen_account();
     } catch (midcom_error $e) {
         midcom::get('auth')->drop_sudo();
         $e->log();
         $handler->print_error($e->getMessage());
         midcom::get('auth')->drop_sudo();
         return false;
     }
     midcom::get('auth')->drop_sudo();
     return true;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:30,代码来源:interfaces.php

示例5: _on_initialize

 /**
  * Initialization script placeholder. Not yet needed.
  *
  * @return boolean Indicating success
  */
 public function _on_initialize()
 {
     // Enable jQuery. This will not work without
     midcom::get('head')->enable_jquery();
     midcom::get('head')->add_jsfile(MIDCOM_STATIC_URL . '/midcom.helper.datamanager2/datamanager2.tablesorter.js');
     // Default values
     $sortable_rows = 'false';
     $sortable_columns = 'false';
     if (!$this->_type->row_limit) {
         $this->_type->row_limit = 0;
     }
     if (!$this->_type->column_limit) {
         $this->_type->column_limit = 0;
     }
     if ($this->_type->sortable_rows) {
         $sortable_rows = 'true';
     }
     if ($this->_type->sortable_columns) {
         $sortable_columns = 'true';
     }
     $preserve_columns = '|' . implode('|,|', array_keys($this->_type->columns)) . '|';
     // Configuration options
     midcom::get('head')->add_jscript("\n            jQuery(document).ready(function()\n            {\n                jQuery('#midcom_helper_datamanager2_{$this->_type->name}_widget_tabledata')\n                    .create_tablesorter({\n                        table_id: '#midcom_helper_datamanager2_{$this->_type->name}_widget_tabledata',\n                        field_name: '{$this->_type->name}',\n                        max_row_count: {$this->_type->row_limit},\n                        max_column_count: {$this->_type->column_limit},\n                        sortable_rows: {$sortable_rows},\n                        sortable_columns: {$sortable_columns},\n                        preserve_columns: '{$preserve_columns}',\n                        allow_delete: true\n                    });\n            });\n\n            COLUMN_TITLE = '" . $this->_type->_l10n->get('please enter the column title') . "';\n        ");
     return true;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:30,代码来源:tabledata.php

示例6: testCRUD

 public function testCRUD()
 {
     midcom::get('auth')->request_sudo('org.openpsa.invoices');
     $data = new org_openpsa_invoices_billing_data_dba();
     $data->linkGuid = self::$_contact->guid;
     $data->useContactAddress = true;
     $stat = $data->create();
     $this->assertTrue($stat, midcom_connection::get_error_string());
     $this->register_object($data);
     $parent = $data->get_parent();
     $this->assertEquals($parent->guid, self::$_contact->guid);
     self::$_contact->refresh();
     $this->assertEquals(self::$_contact->street, $data->street);
     $data->vat = 12;
     $data->due = 12;
     $stat = $data->update();
     $this->assertTrue($stat);
     self::$_contact->refresh();
     $invoice = new org_openpsa_invoices_invoice_dba();
     $invoice->customerContact = self::$_contact->id;
     $invoice_data = $invoice->get_billing_data();
     $this->assertEquals($data->guid, $invoice_data->guid);
     $this->assertEquals($data->vat, $invoice->get_default('vat'));
     $this->assertEquals($data->due, $invoice->get_default('due'));
     $stat = $data->delete();
     $this->assertTrue($stat);
     midcom::get('auth')->drop_sudo();
 }
开发者ID:nemein,项目名称:openpsa,代码行数:28,代码来源:dataTest.php

示例7: testHandler_index_timestamp

 public function testHandler_index_timestamp()
 {
     midcom::get('auth')->request_sudo('org.openpsa.expenses');
     $data = $this->run_handler('org.openpsa.expenses', array('2011-01-26'));
     $this->assertEquals('index_timestamp', $data['handler_id']);
     midcom::get('auth')->drop_sudo();
 }
开发者ID:nemein,项目名称:openpsa,代码行数:7,代码来源:indexTest.php

示例8: _handler_edit

 /**
  * Handler for folder metadata. Checks for updating permissions, initializes
  * the metadata and the content topic itself. Handles also the sent form.
  *
  * @param mixed $handler_id The ID of the handler.
  * @param Array $args The argument list.
  * @param Array &$data The local request data.
  * @return boolean Indicating success
  */
 public function _handler_edit($handler_id, array $args, array &$data)
 {
     $this->_object = midcom::get('dbfactory')->get_object_by_guid($args[0]);
     // FIXME: We should modify the schema according to whether or not scheduling is used
     $this->_object->require_do('midgard:update');
     midcom::get('auth')->require_user_do('midgard.admin.asgard:manage_objects', null, 'midgard_admin_asgard_plugin');
     if (is_a($this->_object, 'midcom_db_topic')) {
         // This is a topic
         $this->_topic->require_do('midgard.admin.asgard:topic_management');
     }
     $this->_metadata = midcom_helper_metadata::retrieve($this->_object);
     if (!$this->_metadata) {
         throw new midcom_error("Failed to retrieve Metadata for " . get_class($this->_object) . " {$this->_object->guid}.");
     }
     // Load the DM2 controller instance
     $this->_controller = $this->get_controller('simple', $this->_object);
     switch ($this->_controller->process_form()) {
         case 'save':
             // Reindex the object
             //$indexer = midcom::get('indexer');
             //net_nemein_wiki_viewer::index($this->_request_data['controller']->datamanager, $indexer, $this->_topic);
             // *** FALL-THROUGH ***
             midcom::get('cache')->invalidate($this->_object->guid);
             return new midcom_response_relocate("__mfa/asgard/object/metadata/{$this->_object->guid}");
         case 'cancel':
             return new midcom_response_relocate("__mfa/asgard/object/view/{$this->_object->guid}");
     }
     $this->_prepare_request_data();
     midgard_admin_asgard_plugin::bind_to_object($this->_object, $handler_id, $data);
 }
开发者ID:nemein,项目名称:openpsa,代码行数:39,代码来源:metadata.php

示例9: org_routamc_positioning_send_sms

function org_routamc_positioning_send_sms($to, $message, $from, $config)
{
    $sms_lib = 'org.openpsa.smslib';
    midcom::get('componentloader')->load_library($sms_lib);
    $sms_lib_api = $config->get('smslib_api');
    $sms_lib_location = $config->get('smslib_uri');
    $sms_lib_client_id = $config->get('smslib_client_id');
    $sms_lib_user = $config->get('smslib_user');
    $sms_lib_password = $config->get('smslib_password');
    if (!$sms_lib_api || !$sms_lib_location || !$sms_lib_user) {
        return false;
    }
    @ini_set('max_execution_time', 0);
    //Initializing SMS broker
    $smsbroker = call_user_func(array(str_replace('.', '_', $sms_lib), 'factory'), $sms_lib_api);
    if (!is_object($smsbroker)) {
        debug_add(str_replace('.', '_', $sms_lib) . "::factory({$sms_lib_api}) returned: {$smsbroker}", MIDCOM_LOG_ERROR);
        return false;
    }
    $smsbroker->location = $sms_lib_location;
    $smsbroker->client_id = $sms_lib_client_id;
    $smsbroker->user = $sms_lib_user;
    $smsbroker->password = $sms_lib_password;
    return $smsbroker->send_sms($to, $message, $from);
}
开发者ID:nemein,项目名称:openpsa,代码行数:25,代码来源:manual-position.php

示例10: testHandler_edit

 public function testHandler_edit()
 {
     midcom::get('auth')->request_sudo('org.openpsa.products');
     $data = $this->run_handler('org.openpsa.products', array('product', 'edit', self::$_product->guid));
     $this->assertEquals('edit_product', $data['handler_id']);
     midcom::get('auth')->drop_sudo();
 }
开发者ID:nemein,项目名称:openpsa,代码行数:7,代码来源:editTest.php

示例11: move_extensions_to_object

 /**
  * Transfers all parameters attachments and privileges on the current object to another
  * existing Midgard object. You need to have midgard:update, midgard:parameter,
  * midgard:privileges and midgard:attachments privileges on the target object,
  * which must be a persistent MidCOM DBA class instance. (For ease of use, it is recommended
  * to have midgard:owner rights for the target object, which includes the above
  * privileges).
  *
  * <b>Important notes:</b>
  *
  * All records in question will just be moved, not copied!
  * Also, there will be <i>no</i> integrity checking in terms of already existing
  * parameters etc. This feature is mainly geared towards preparing a freshly
  * created final object with the data associated with this temporary object.
  *
  * Any invalid object / missing privilege will trigger a midcom_error.
  *
  * @param midcom_dba_object $object The object to transfer the extensions to.
  */
 function move_extensions_to_object($object)
 {
     if (!midcom::get('dbclassloader')->is_midcom_db_object($object)) {
         throw new midcom_error('The object passed is no valid for move_extensions_to_object.');
     }
     // Validate Privileges
     $object->require_do('midgard:update');
     $object->require_do('midgard:privileges');
     $object->require_do('midgard:parameters');
     $object->require_do('midgard:attachments');
     // Copy parameters from temporary object
     $parameters = $this->list_parameters();
     foreach ($parameters as $domain => $array) {
         foreach ($array as $name => $value) {
             $object->set_parameter($domain, $name, $value);
         }
     }
     // Move attachments from temporary object
     $attachments = $this->list_attachments();
     foreach ($attachments as $attachment) {
         $attachment->parentguid = $object->guid;
         $attachment->update();
     }
     // Privileges are moved using the DBA API as well.
     $privileges = $this->get_privileges();
     if ($privileges) {
         foreach ($privileges as $privilege) {
             $privilege->set_object($object);
             $privilege->store();
         }
     }
 }
开发者ID:nemein,项目名称:openpsa,代码行数:51,代码来源:object.php

示例12: _handler_approval

 /**
  * Checks the integrity of the content topic and gets the stored approvals of
  * the content folder.
  *
  * @param mixed $handler_id The ID of the handler.
  * @param Array $args The argument list.
  * @param Array &$data The local request data.
  */
 public function _handler_approval($handler_id, array $args, array &$data)
 {
     if (!array_key_exists('guid', $_REQUEST) || !array_key_exists('return_to', $_REQUEST)) {
         throw new midcom_error('Cannot process approval request, request is incomplete.');
     }
     $object = midcom::get('dbfactory')->get_object_by_guid($_REQUEST['guid']);
     $object->require_do('midcom:approve');
     $metadata = midcom_helper_metadata::retrieve($object);
     if (!$metadata) {
         throw new midcom_error("Failed to retrieve Metadata for " . get_class($object) . " {$object->guid}.");
     }
     /**
      * This flag is used to make it possible to explicitly recognize user intent
      * to for example do special operations in midcom.helper.replicator
      */
     if (!isset($GLOBALS['midcom_admin_folder_handler_approvals']) || !is_array($GLOBALS['midcom_admin_folder_handler_approvals'])) {
         $GLOBALS['midcom_admin_folder_handler_approvals'] = array();
     }
     if ($handler_id == '____ais-folder-approve') {
         $GLOBALS['midcom_admin_folder_handler_approvals'][$object->guid] = 'approve';
         $metadata->approve();
     } else {
         $GLOBALS['midcom_admin_folder_handler_approvals'][$object->guid] = 'unapprove';
         $metadata->unapprove();
     }
     return new midcom_response_relocate($_REQUEST['return_to']);
 }
开发者ID:nemein,项目名称:openpsa,代码行数:35,代码来源:approvals.php

示例13: _on_execute

 /**
  * Loads all entries that need to be processed and processes them.
  */
 public function _on_execute()
 {
     $qb = midcom_services_at_entry_dba::new_query_builder();
     // (to be) start(ed) AND last touched over two days ago
     $qb->add_constraint('start', '<=', time() - 3600 * 24 * 2);
     $qb->begin_group('OR');
     $qb->add_constraint('host', '=', midcom_connection::get('host'));
     $qb->add_constraint('host', '=', 0);
     $qb->end_group();
     $qb->add_constraint('metadata.revised', '<=', date('Y-m-d H:i:s', time() - 3600 * 24 * 2));
     $qb->add_constraint('status', '>=', midcom_services_at_entry_dba::RUNNING);
     midcom::get('auth')->request_sudo('midcom.services.at');
     $qbret = $qb->execute();
     if (empty($qbret)) {
         debug_add('Got empty resultset, exiting');
         midcom::get('auth')->drop_sudo();
         return;
     }
     foreach ($qbret as $entry) {
         debug_add("Deleting dangling entry #{$entry->id}\n", MIDCOM_LOG_INFO);
         debug_print_r("Entry #{$entry->id} dump: ", $entry);
         $entry->delete();
     }
     midcom::get('auth')->drop_sudo();
 }
开发者ID:nemein,项目名称:openpsa,代码行数:28,代码来源:clean.php

示例14: testHandler_groupsblock

 public function testHandler_groupsblock()
 {
     midcom::get('auth')->request_sudo('org.openpsa.products');
     $data = $this->run_handler('org.openpsa.products', array('groupsblock', self::$_group->code, 'foo'));
     $this->assertEquals('groupsblock', $data['handler_id']);
     midcom::get('auth')->drop_sudo();
 }
开发者ID:nemein,项目名称:openpsa,代码行数:7,代码来源:groupsblockTest.php

示例15: test_get_default

 public function test_get_default()
 {
     $config = array('type_config' => array('allow_multiple' => false, 'options' => array(1 => 'value 1', 2 => 'value 2')));
     $default_values = array('test_select_1' => array(2));
     midcom::get('auth')->request_sudo('midcom.helper.datamanager2');
     $dm2_helper = new openpsa_test_dm2_helper();
     $widget = $dm2_helper->get_widget('select', 'select', $config);
     $this->assertNull($widget->get_default(), 'nullstorage test failed');
     $dm2_helper->defaults = array('test_select_1' => 2);
     $widget = $dm2_helper->get_widget('select', 'select', $config);
     $this->assertEquals($default_values, $widget->get_default(), 'nullstorage/default test failed');
     $config['storage'] = 'type';
     $event = new midcom_db_event();
     $dm2_helper = new openpsa_test_dm2_helper($event);
     $widget = $dm2_helper->get_widget('select', 'select', $config);
     $this->assertNull($widget->get_default(), 'create test failed');
     $dm2_helper->defaults = array('test_select_1' => 2);
     $widget = $dm2_helper->get_widget('select', 'select', $config);
     $this->assertEquals($default_values, $widget->get_default(), 'create/default test failed');
     $event = $this->create_object('midcom_db_event');
     $dm2_helper = new openpsa_test_dm2_helper($event);
     $widget = $dm2_helper->get_widget('select', 'select', $config);
     $this->assertEquals('', $widget->get_default(), 'simple test failed');
     $event->type = 2;
     $event->update();
     $dm2_helper = new openpsa_test_dm2_helper($event);
     //Lazy workaround to reuse the default array from above
     $dm2_helper->get_widget('select', 'select', $config);
     $widget = $dm2_helper->get_widget('select', 'select', $config);
     $this->assertEquals($default_values, $widget->get_default(), 'simple/storage test failed');
     midcom::get('auth')->drop_sudo();
 }
开发者ID:nemein,项目名称:openpsa,代码行数:32,代码来源:selectTest.php


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