示例#1
0
 /**
  * All forms with their categories
  * @return array
  */
 public static function all_forms()
 {
     $forms = array(0 => 'None');
     $categories = BuiltForm::get(array('category'));
     foreach ($categories as $category) {
         $names = array();
         foreach (BuiltForm::where('category', '=', $category->category)->get(array('id', 'name')) as $form) {
             // Get only the form names
             $names[$form->id] = $form->name;
         }
         $forms[FormCategory::find($category->category)->name] = $names;
     }
     return $forms;
 }
示例#2
0
文件: Menu.php 项目: jrafaelca/Doptor
 /**
  * The list that is displayed while selecting item for menu
  * @return array
  */
 public static function menu_lists()
 {
     $modules = array();
     foreach (Module::all(array('name', 'links')) as $module) {
         if ($module->links != '') {
             $links = json_decode($module->links);
             foreach ($links as $link) {
                 $modules['link_type/modules/' . $link->alias] = $link->name;
             }
         } else {
             $modules['link_type/modules/' . Str::slug($module->name, '_')] = $module->name;
         }
     }
     $pages = array();
     foreach (Post::type('page')->get(array('title', 'permalink')) as $page) {
         $pages['pages/' . $page->permalink] = $page->title;
     }
     $post_categories = array();
     foreach (Category::type('post')->get(array('name', 'alias')) as $page_category) {
         $post_categories['posts/category/' . $page_category->alias] = $page_category->name;
     }
     $contacts = array();
     foreach (Components\ContactManager\Models\ContactDetail::get(array('name', 'alias')) as $contact) {
         $contacts['contact/show/' . $contact->alias] = $contact->name;
     }
     $contact_categories = array();
     foreach (Components\ContactManager\Models\ContactCategory::get(array('name', 'alias')) as $contact_cat) {
         $contact_categories['contact/' . $contact_cat->alias] = $contact_cat->name;
     }
     $forms = array();
     foreach (BuiltForm::get(array('name', 'id')) as $contact_cat) {
         $forms['link_type/form/' . $contact_cat->id] = $contact_cat->name;
     }
     $report_generators = array();
     foreach (Components\ReportGenerator\Models\ReportGenerator::get(array('name', 'id')) as $report_generator) {
         $report_generators['admin/report-generators/generate/' . $report_generator->id] = $report_generator->name;
     }
     return array('/' => 'Home', 'Pages' => $pages, 'posts' => 'Posts', 'Post Categories' => $post_categories, 'Modules' => $modules, 'Contact Categories' => $contact_categories, 'Contacts' => $contacts, 'Forms' => $forms, 'Report Generators' => $report_generators, 'manual' => 'External link');
 }