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


PHP midgardmvc_core类代码示例

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


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

示例1: can_view

 public function can_view($user = null)
 {
     if (midgardmvc_core::get_instance()->context->mimetype === 'text/html') {
         return true;
     }
     return false;
 }
开发者ID:bergie,项目名称:midgardmvc_core,代码行数:7,代码来源:uimessages.php

示例2: load_object

 /**
  * Loads a program
  */
 public function load_object(array $args)
 {
     $this->object = com_meego_devprogram_devutils::get_device_by_name($args['device_name']);
     if (is_object($this->object)) {
         midgardmvc_core::get_instance()->head->set_title($this->object->name);
     }
 }
开发者ID:nemein,项目名称:com_meego_devprogram,代码行数:10,代码来源:devices.php

示例3: action_messages

 public function action_messages($route_id, &$data, $args)
 {
     if (!midgardmvc_core::get_instance()->uimessages->supports('comet') || !midgardmvc_core::get_instance()->uimessages->can_view()) {
         return;
     }
     $type = null;
     $name = null;
     if (isset(midgardmvc_core::get_instance()->dispatcher->get["cometType"])) {
         $type = midgardmvc_core::get_instance()->dispatcher->get["cometType"];
     }
     if (isset(midgardmvc_core::get_instance()->dispatcher->get["cometName"])) {
         $name = midgardmvc_core::get_instance()->dispatcher->get["cometName"];
     }
     if ($type == null && $name == null) {
         throw new midgardmvc_exception_notfound("No comet name or type defined");
     }
     if (ob_get_level() == 0) {
         ob_start();
     }
     while (true) {
         $messages = '';
         if (midgardmvc_core::get_instance()->uimessages->has_messages()) {
             $messages = midgardmvc_core::get_instance()->uimessages->render_as('comet');
         } else {
             midgardmvc_core::get_instance()->uimessages->add(array('title' => 'Otsikko from comet', 'message' => 'viesti from comet...'));
         }
         midgardmvc_core_helpers_comet::pushdata($messages, $type, $name);
         ob_flush();
         flush();
         sleep(5);
     }
     // $data['messages'] = $messages;
 }
开发者ID:piotras,项目名称:midgardmvc_core,代码行数:33,代码来源:comet.php

示例4: tearDown

 public function tearDown()
 {
     // Delete the context
     $this->_core->context->delete();
     midgardmvc_core::clear_instance();
     parent::tearDown();
 }
开发者ID:bergie,项目名称:midgardmvc_core,代码行数:7,代码来源:testcase.php

示例5: get_avatar

 public function get_avatar(array $args)
 {
     $storage = new midgard_query_storage('midgard_user');
     $q = new midgard_query_select($storage);
     $cnstr1 = new midgard_query_constraint(new midgard_query_property('username', $storage), 'LIKE', new midgard_query_value('%' . $args['username'] . '%'));
     $q->execute();
     $cnt = $q->get_results_count();
     if ($cnt > 0) {
         $user = $q->list_objects();
         if ($user[0]) {
             $attachments = $user[0]->list_attachments();
             //Check if attachement exists
             if (count($attachments) == 0) {
                 //fetch avatar from meego.com
                 $employeenumber = $user[0]->get_person()->get_parameter('midgardmvc_core_services_authentication_ldap', 'employeenumber');
                 $attachment = $user[0]->create_attachment('meego:avatar', 'meego:avatar', 'image/png');
                 midgardmvc_helper_attachmentserver::copy_file_to_attachment('http://meego.com/sites/all/files/imagecache/user_pics/user_pics/picture-' . $employeenumber . '.png', $attachment);
                 $attachments[0] = $attachment;
             }
             if (count($attachments) > 0) {
                 //serve attachment
                 $this->serve_attachement($attachments[0]);
                 return;
             }
         }
     }
     //redirect to default avatar
     midgardmvc_core::get_instance()->head->relocate('http://meego.com/sites/all/themes/meego/images/peep_skate.png');
 }
开发者ID:nemein,项目名称:com_meego_website,代码行数:29,代码来源:avatar.php

示例6: PHPTAL_GetTextTranslator

 public function &set_translation_domain($component_name)
 {
     // If no component name is set, then it's from the core
     // translations are going to get searched.
     if (!$component_name) {
         $component_name = 'midgardmvc_core';
     }
     // Checking if TAL translator is already available
     if (isset($this->tr[$component_name])) {
         // useDomain must be called. Otherwise gettext context is not changed
         $this->tr[$component_name]->useDomain($component_name);
         return $this->tr[$component_name];
     }
     try {
         $this->tr[$component_name] = new PHPTAL_GetTextTranslator();
         $this->tr[$component_name]->setLanguage($this->language . '.utf8', $this->language);
     } catch (Exception $e) {
         echo $e;
     }
     // register gettext domain to use
     $path = midgardmvc_core::get_component_path($component_name) . '/locale/';
     $this->tr[$component_name]->addDomain($component_name, $path);
     // specify current domain
     $this->tr[$component_name]->useDomain($component_name);
     return $this->tr[$component_name];
 }
开发者ID:bergie,项目名称:midgardmvc_core,代码行数:26,代码来源:gettext.php

示例7: get_cache_name

 private function get_cache_name()
 {
     if (!isset(midgardmvc_core::get_instance()->context->host)) {
         return 'MidgardMVC';
     }
     return midgardmvc_core::get_instance()->context->host->name;
 }
开发者ID:piotras,项目名称:midgardmvc_core,代码行数:7,代码来源:sqlite3.php

示例8: get_invalidate

 public function get_invalidate(array $args)
 {
     midgardmvc_core::get_instance()->authorization->require_user();
     midgardmvc_core::get_instance()->cache->invalidate_all();
     midgardmvc_core::get_instance()->context->cache_enabled = false;
     midgardmvc_core::get_instance()->head->relocate(midgardmvc_core::get_instance()->dispatcher->generate_url('index', array(), $this->request));
 }
开发者ID:bergie,项目名称:midgardmvc_core,代码行数:7,代码来源:cache.php

示例9: post_start_package_instance

 /**
  *
  */
 public function post_start_package_instance(array $args)
 {
     $this->mvc->log(__CLASS__, 'Posted start QA', 'info');
     $this->package = self::load_package_instance($args);
     if (!$this->package->metadata->hidden) {
         $workflow_class = self::load_workflow($args);
         $this->mvc->component->load_library('Workflow');
         $workflow = new $workflow_class();
         $values = $workflow->start($this->package);
         if (isset($values['execution'])) {
             // Workflow suspended and needs input, redirect to workflow page
             $formurl = $this->mvc->dispatcher->generate_url('package_instance_workflow_resume', array('package' => $this->package->name, 'version' => $this->package->version, 'project' => $args['project'], 'repository' => $args['repository'], 'arch' => $args['arch'], 'workflow' => $args['workflow'], 'execution' => $values['execution']), $this->request);
             $this->mvc->head->relocate($formurl);
         }
     }
     // Workflow completed, redirect to package instance
     if ($this->request->isset_data_item('redirect_link')) {
         $redirect_link = $this->request->get_data_item('redirect_link');
     } elseif (isset($_POST['redirect_link'])) {
         $redirect_link = $_POST['redirect_link'];
     } else {
         $redirect_link = midgardmvc_core::get_instance()->dispatcher->generate_url('package_instance', array('package' => $this->package->name, 'version' => $this->package->version, 'project' => $args['project'], 'repository' => $args['repository'], 'arch' => $args['arch']), $this->request);
     }
     $this->mvc->log(__CLASS__, 'Posted start QA finished', 'info');
     // Workflow completed, redirect to package instance
     midgardmvc_core::get_instance()->head->relocate($redirect_link);
 }
开发者ID:nemein,项目名称:com_meego_packages,代码行数:30,代码来源:workflow.php

示例10: __construct

 /**
  * The constructor will initialize the sessioning, set the output nocacheable
  * and initialize the session data. This might involve creating an empty
  * session array.
  */
 public function __construct()
 {
     static $started = false;
     if ($started) {
         throw new Exception("Midgard MVC Sessioning has already been started, it must not be started twice. Aborting");
     }
     $started = true;
     $this->dispatcher = midgardmvc_core::get_instance()->dispatcher;
     try {
         if (!$this->dispatcher->headers_sent()) {
             $this->dispatcher->session_start();
         }
     } catch (Exception $e) {
         midgardmvc_core::get_instance()->log(__CLASS__, "Couldn't start session: " . $e->getMessage(), 'warn');
         $this->enabled = false;
         return;
     }
     /* Cache disabling made conditional based on domain/key existence */
     // Check for session data and load or initialize it, if necessary
     if ($this->dispatcher->session_has_var(self::ROOT)) {
         $this->data = $this->dispatcher->session_get_var(self::ROOT);
     } else {
         $this->data['midgardmvc_core_services_sessioning'] = array();
         $this->data['midgardmvc_core_services_sessioning']['startup'] = array();
         $this->dispatcher->session_set_var(self::ROOT, $this->data);
     }
 }
开发者ID:piotras,项目名称:midgardmvc_core,代码行数:32,代码来源:midgard.php

示例11: start

 private function start()
 {
     if (self::$started) {
         return;
     }
     self::$started = true;
     $this->dispatcher = midgardmvc_core::get_instance()->dispatcher;
     try {
         if (!$this->dispatcher->headers_sent()) {
             $this->dispatcher->session_start();
         }
     } catch (Exception $e) {
         midgardmvc_core::get_instance()->log(__CLASS__, "Couldn't start session: " . $e->getMessage(), 'warning');
         $this->enabled = false;
         return;
     }
     /* Cache disabling made conditional based on domain/key existence */
     // Check for session data and load or initialize it, if necessary
     if ($this->dispatcher->session_has_var(self::ROOT)) {
         $this->data = $this->dispatcher->session_get_var(self::ROOT);
     } else {
         $this->data['midgardmvc_core_services_sessioning'] = array();
         $this->data['midgardmvc_core_services_sessioning']['startup'] = array();
         $this->dispatcher->session_set_var(self::ROOT, $this->data);
     }
 }
开发者ID:bergie,项目名称:midgardmvc_core,代码行数:26,代码来源:midgard.php

示例12: test_singleton

 public function test_singleton()
 {
     $this->_core->newproperty = true;
     $midcom_new = midgardmvc_core::get_instance();
     $this->assertEquals($midcom_new->newproperty, true);
     unset($this->_core->newproperty);
 }
开发者ID:piotras,项目名称:midgardmvc_core,代码行数:7,代码来源:core.php

示例13: get_feed

 public function get_feed(array $args)
 {
     // Read items from Content Repository
     $this->get_items($args);
     // Set up feed
     midgardmvc_core::get_instance()->component->load_library('Feed');
     $feed = new ezcFeed();
     $feed->title = $this->data['title'];
     $feed->description = '';
     $now = new DateTime();
     $feed->published = $now->format(DateTime::RSS);
     $link = $feed->add('link');
     $link->href = midgardmvc_core::get_instance()->dispatcher->generate_url('index', array(), $this->request);
     array_walk($this->data['items'], function ($item) use($feed) {
         $feeditem = $feed->add('item');
         $feeditem->title = $item->title;
         $feeditem->description = $item->content;
         $feeditem->published = $item->published->format(DateTime::RSS);
         $author = $feeditem->add('author');
         $author->name = $item->firstname;
         $link = $feeditem->add('link');
         $link->href = $item->url;
     });
     $this->data['feed'] = $feed;
 }
开发者ID:nemein,项目名称:com_meego_planet,代码行数:25,代码来源:latest.php

示例14: extend_provider

 /**
  * Adds some handy properties to provider object
  *
  * @param object com_meego_devprogram_provider object
  * @return object extended com_meego_devprogram_provider object
  */
 private function extend_provider($object = null)
 {
     // q->toggle_readonly(false) does not work so we need a new object
     $provider = new com_meego_devprogram_provider($object->guid);
     $provider->read_url = com_meego_devprogram_utils::get_url('provider_read', array('provider_name' => $provider->name));
     $provider->update_url = com_meego_devprogram_utils::get_url('provider_update', array('provider_name' => $provider->name));
     $provider->delete_url = com_meego_devprogram_utils::get_url('provider_delete', array('provider_name' => $provider->name));
     $provider->join_url = com_meego_devprogram_utils::get_url('my_membership_create', array('provider_name' => $provider->name));
     // if current user is owner then we can add more goodies
     $user = com_meego_devprogram_utils::get_current_user();
     $provider->number_of_members = false;
     $mvc = midgardmvc_core::get_instance();
     // set the can join flag to true by default
     $provider->can_join = true;
     // set management fflag to false by default
     $provider->can_manage = false;
     // can current user manage the provider
     if (com_meego_devprogram_utils::is_current_user_creator_or_admin($object) || com_meego_devprogram_membutils::is_current_user_member_of_provider($object->id)) {
         $provider->can_manage = true;
         $provider->can_join = false;
         // set the url for the membership list page
         $provider->list_memberships_url = com_meego_devprogram_utils::get_url('provider_members', array('provider_name' => $provider->name));
         // set the approved number of members (all but the cancelled ones) of this provider
         $provider->number_of_members = count(com_meego_devprogram_membutils::get_memberships_by_provider($provider->id));
         // set the number of pending membership requests
         $provider->number_of_members = count(com_meego_devprogram_membutils::get_memberships_by_provider($provider->id));
     }
     // can the provider be deleted; ie. check if provider has devices that belong to open programs
     $provider->can_not_delete = com_meego_devprogram_provutils::has_provider_devices($object->id);
     return $provider;
 }
开发者ID:nemein,项目名称:com_meego_devprogram,代码行数:37,代码来源:provutils.php

示例15: __construct

 public function __construct(array $local_configuration = null)
 {
     if (!is_null($local_configuration)) {
         $this->local_configuration = $local_configuration;
     }
     $this->mvc = midgardmvc_core::get_instance();
 }
开发者ID:bergie,项目名称:midgardmvc_core,代码行数:7,代码来源:chain.php


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