Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 47 lines (45 sloc) 1.59 kB
cc4f641 @bergie Initial Create version
bergie authored
1 <?php
2 /**
ec0074b @bergie Generate injector from the literate doc
bergie authored
3 * This file is generated automatically from Literate Programming code
4 * stored in the README.txt documentation file in this repository.
5 * Instead of modifying this file directly, modify the corresponding
6 * code chunks in README.txt and regenerate it using the tangle command
7 * of noweb.php:
cc4f641 @bergie Initial Create version
bergie authored
8 *
ec0074b @bergie Generate injector from the literate doc
bergie authored
9 * $ noweb.php tangle README.txt
10 *
11 * Read more about the concept in:
12 * @link http://bergie.iki.fi/blog/literate_programming_with_php/
cc4f641 @bergie Initial Create version
bergie authored
13 */
14 class midgardmvc_ui_create_injector
15 {
16 public function inject_process(midgardmvc_core_request $request)
17 {
8fb6920 @bergie Create a new context to baseurl of sent object so its injectors can f…
bergie authored
18 // Register URL handlers
cc4f641 @bergie Initial Create version
bergie authored
19 $request->add_component_to_chain(midgardmvc_core::get_instance()->component->get('midgardmvc_ui_create'));
d670ff7 @bergie Centralize CMS access checks
bergie authored
20 if (midgardmvc_core::get_instance()->context->get_current_context() != 0)
cc4f641 @bergie Initial Create version
bergie authored
21 {
22 return;
23 }
d670ff7 @bergie Centralize CMS access checks
bergie authored
24 if (!self::can_use())
cc4f641 @bergie Initial Create version
bergie authored
25 {
26 return;
27 }
28 midgardmvc_core::get_instance()->head->enable_jquery();
93e2d05 @bergie Include Aloha dependencies individually so we can load our own jQuery
bergie authored
29 midgardmvc_core::get_instance()->head->enable_jquery_ui();
761c80e @bergie Major refactoring of the JS environment, add the toolbar
bergie authored
30 midgardmvc_core::get_instance()->head->add_jsfile(MIDGARDMVC_STATIC_URL . '/midgardmvc_ui_create/js/create.js');
cc4f641 @bergie Initial Create version
bergie authored
31 }
ec0074b @bergie Generate injector from the literate doc
bergie authored
32
33 public function can_use()
34 {
35 if (!midgardmvc_core::get_instance()->authentication->is_user())
36 {
37 return false;
38 }
39 if (midgardmvc_core::get_instance()->authentication->get_user()->usertype == MIDGARD_USER_TYPE_USER)
40 {
41 // We distinquish between CMS users and end-users by ADMIN vs. USER level
42 return false;
43 }
44 return true;
45 }
93e2d05 @bergie Include Aloha dependencies individually so we can load our own jQuery
bergie authored
46 }
Something went wrong with that request. Please try again.