} $pm->addLoop('usergroups', array('usergroupid' => '0', 'usergroupname' => 'Everyone', 'selected' => in_array(0, $selected) ? true : false)); foreach ($usergroups->getAll() as $usergroup) { if (in_array($usergroup['usergroupid'], $selected)) { $usergroup['selected'] = true; } $pm->addLoop('usergroups', $usergroup); } foreach (Typeframe::Registry()->applications() as $app) { //if ('soft' == $app->map()) $pm->addLoop('applications', array('application' => $app->name())); } $pm->sortLoop('applications', 'application'); if (PAGES_DEFAULT_APPLICATION) { $app = Typeframe::Registry()->application(PAGES_DEFAULT_APPLICATION); //if ($app && ('soft' == $app->map())) if ($app) { $pm->setVariable('application', PAGES_DEFAULT_APPLICATION); } } // add skins to template foreach (Typeframe::GetSkins() as $skin) { $pm->addLoop('skins', array('skin' => $skin)); } $pm->setVariable('typef_site_skin', TYPEF_SITE_SKIN); $application = Typeframe::Registry()->application($page['application']); if ($application && $application->admin()) { if (file_exists(TYPEF_SOURCE_DIR . '/scripts' . $application->admin() . '/settings.php')) { Typeframe::IncludeScript($application->admin() . '/settings.php'); } }
<?php /* 29 december 2010: cleanup while trying to add status field to typef_news table; rewrote to use news categories class 3 january 2011: DAOFactory, not DAO_Factory; setCategoryId now static 28 march 2011: merged in HL code 29 march 2011: added page title, header */ // define some handy shortcuts to save typing $settings = Typeframe::CurrentPage()->settings(); if (Typeframe::CurrentPage()->pathInfo()) { Typeframe::IncludeScript('/news/categories/view.php'); return; } if (is_array($settings['categoryid']) && !in_array(0, $settings['categoryid']) && 1 == count($settings['categoryid'])) { Typeframe::Redirect('Redirecting to category listing...', Typeframe::CurrentPage()->applicationUri() . 'categories/' . $settings['categoryid'][0]); return; } // create news category object $categories = News_Category::DAOFactory(); // limit to a particular category id News::SetCategoryId($categories, @$settings['categoryid']); // add categories to template $pm->setVariable('categories', $categories); // add page title and header to template $title = News::GetTitle(); $pm->setVariable('page_title', $title); $pm->setVariable('page_header', $title);
private function _executeTriggers($when) { if ($this->stopped()) { return; } $currentPath = $this->path(); foreach (Typeframe::Registry()->getTriggersWhen($when) as $trigger) { $triggerOnPath = false; if ($trigger->path() == $currentPath) { $triggerOnPath = true; } else { if (substr($trigger->path(), 0, 1) == '*') { $triggerOnPath = true; } else { $asterisk = strpos($trigger->path(), '*'); if ($asterisk !== false) { $path = substr($trigger->path(), 0, $asterisk); if ($currentPath == $path) { $triggerOnPath = true; } else { if (substr($currentPath, 0, strlen($path)) == $path) { if (substr($trigger->path(), $asterisk - 1, 1) == '/') { $triggerOnPath = true; } else { if (substr($currentPath, $asterisk, 1) == '/') { $triggerOnPath = true; } } } } } } } if ($triggerOnPath) { Typeframe::IncludeScript($trigger->script()); } if (Typeframe::CurrentPage()->stopped()) { return; } } }
<?php /* * Applications can add their own control panels to the Admin index with a * script in the source/scripts/admin/index directory. * * Access to administrable pages (e.g., Content pages) is provided by adding * an element to the admin_pages array. The easiest way to add the element is * to use a Model_Page record and add the URL to the application's relevant * control panel (e.g., ~/admin/content/page?pageid=#). * * Custom navigation panels can be added to the index through the * admin_categories array. Each element should contain two keys: name (the name * of the category) and template (the relative path to the template). In the * default skin, the category name gets added to a list of tabs and the template * gets inserted into the corresponding panel. The application's script can add * add data to the Typeframe::Pagemill() object if necessary. */ $scripts = scandir(TYPEF_SOURCE_DIR . '/scripts/admin.d'); foreach ($scripts as $script) { if (substr($script, 0, 1) != '.') { Typeframe::IncludeScript("/admin.d/{$script}"); } } if ($pm->getVariable('admin_pages')) { $pm->sortLoop('admin_pages', 'nickname'); } if ($pm->getVariable('admin_categories')) { $pm->sortLoop('admin_categories', 'name'); }
<?php /** * Typeframe Install application * * admin-side index controller */ /* * TODO: The Installer needs to handle dependencies elegantly. This includes * the ability to detect when local copies of a dependency's files have been * customized. This process appears to handle the most scenarios: * 1. Query the provider for the package's dependencies. * 2. If the package or any of its dependencies exist, check the md5 hash * on the files and look for changes. Recurse into deeper dependencies. * 3. If local changes exist, request confirmation for which files should be * overwritten. */ if ('POST' == $_SERVER['REQUEST_METHOD']) { // TODO: don't do.php Typeframe::IncludeScript('/admin/install/do.php'); }