<?php apf_require_page('MobileBasePage'); class Wiki_WikiPage extends MobileBasePage { public function get_decorator() { return 'decorators/Wiki'; } public function get_view() { $attrs = APF::get_instance()->get_request()->get_attributes(); foreach ($attrs as $key => $attr) { $this->assign_data($key, $attr); } return 'Wiki'; } public function get_title() { return '经纪人移动API文档'; } } # end of this file
<?php apf_require_page('iBugDecorator'); class Ddcomponent_AddPage extends iBugDecoratorPage { public static function use_boundable_styles() { $path = apf_classname_to_path(__CLASS__); return array_merge(parent::use_boundable_styles(), array($path . 'Add.css')); } public static function use_boundable_javascripts() { $path = apf_classname_to_path(__CLASS__); return array_merge(parent::use_boundable_javascripts(), array($path . "Add.js")); } public function get_view() { return 'Add'; } }
/** * 实际结果就是更新APF->boundable_resources变量,将用到的资源文件(整合)路径信息 * 记录到boundable_resources中。 * @todo 非递归实现 * @param string $class 文件名<->资源文件名与页面类名是一一对应的 * @param string $ext 文件扩展名 * @param boolen $is_page 是否为页面类 */ protected function fetch_boundable_resources($class, $ext, $is_page = false) { if ($is_page) { if ($pos = strpos($class, "(")) { $class = substr($class, 0, $pos); } apf_require_page($class); $path = "page/"; $class = $class . "Page"; } else { // 载入组件类 apf_require_component($class); $path = "component/"; $class = $class . "Component"; } if (!class_exists($class)) { return false; } // 获取组件(页面)使用的组件列表 eval("\$list = {$class}" . "::use_component();"); foreach ($list as $item) { // 载入所有子组件用到的资源文件 $this->fetch_boundable_resources($item, $ext); } // 获取用到的资源文件相对路径 if ($ext == 'js') { eval("\$list = {$class}::use_boundable_javascripts();"); } elseif ($ext == 'css') { eval("\$list = {$class}::use_boundable_styles();"); } else { trigger_error("Unknown extention \"{$ext}\"", E_USER_WARNING); $list = array(); } $apf = APF::get_instance(); foreach ($list as $item) { // 获取资源文件的绝对路径 $apf->prcess_resource_url($path, $item, $this->boundable_resources); } return true; }
/** * @param string $class * @return APF_Component */ public function load_component($parent, $class, $is_page = false) { $flag = true; if ($is_page) { $this->debug("load page: {$class}"); $flag = apf_require_page($class); $class = $class . "Page"; } else { $this->debug("load component: {$class}"); $flag = apf_require_component($class); $class = $class . "Component"; } if (!$flag && substr($class, 0, 3) == "HK_") { $class = substr($class, 3); } $this->html_id++; return new $class($parent, self::HTML_ID_PREFIX . $this->html_id); }
<?php /** * Created by PhpStorm. * User: emily * Date: 8/31/15 * Time: 10:52 PM */ apf_require_page("CMS"); class Group_UsertopicsPage extends CMSPage { public static function use_boundable_styles() { $path = apf_classname_to_path(__CLASS__); return array_merge(parent::use_boundable_styles(), array()); } public static function use_boundable_javascripts() { $path = apf_classname_to_path(__CLASS__); return array_merge(parent::use_boundable_javascripts(), array()); } public function get_title() { $str = "安居客CMS系统"; return $str; } public function get_head_sections() { $sections = parent::get_head_sections(); return $sections; }
<?php apf_require_page("BrokerBase"); class MobileBasePage extends BrokerBasePage { public function get_decorator() { return parent::get_decorator(); } public function get_view() { return "MobileBase"; } }
<?php apf_require_controller('Abstract'); apf_require_page('Abstract'); apf_require_class('Biz_Project'); apf_require_class('Biz_OperateLog'); apf_require_class('Biz_Exclude'); apf_require_class('Biz_Host'); class HostController extends AbstractController { public function handle_request_internel() { switch ($this->_match[1]) { case 'edit': return $this->_edit(); break; } } private function _edit() { if ($this->_request->is_post_method()) { $this->_save(); } $pid = intval($this->_param['pid']); $hosts = Biz_Host::get_instance()->get_host($pid); $host_br = array(); foreach ($hosts as $host) { $host_br[] = $host->hostname; } $host_br = implode("\n", $host_br); $this->_request->set_attribute('page_title', '修改 主机名');
<?php apf_require_class("PageHelper"); apf_require_page("AnjukeBrokerShare"); class User_Statistics_BrokerStatisticsPage extends BrokerBasePage { public function get_header() { return 'Global_Broker_BrokerShareHeaderSimple'; } public function get_view() { $request = APF::get_instance()->get_request(); $pageParams = $request->get_attributes(); foreach ($pageParams as $k => $v) { $this->assign_data($k, $v); } $this->assign_data('actionURL', $request->get_request_url()); $business = $pageParams['business']; $templateList = array('ajk' => 'BrokerStatisticsAjk', 'hz' => 'BrokerStatisticsHz', 'jp' => 'BrokerStatisticsJp'); if (isset($templateList[$business])) { return $templateList[$business]; } return 'BrokerStatistics'; } public static function use_javascripts() { $path = apf_classname_to_path(__CLASS__); return array_merge(parent::use_javascripts(), array(array(PageHelper::pure_static_url("/js/jquery-ui/jquery-ui-1.10.4.custom.min.js")), array(PageHelper::pure_static_url("/js/jquery.align.js"), PHP_INT_MAX - 1))); } public static function use_styles()
<?php apf_require_page('BrokerBasePage'); class Home_BrokerHomePage extends BrokerBasePage { public function get_view() { return 'BrokerHome'; } public function get_title() { return '经纪人后台首页的Demo'; } public static function use_boundable_javascripts() { $path = apf_classname_to_path(__CLASS__); return array_merge(parent::use_boundable_javascripts(), array($path . 'BrokerHome.js')); } public static function use_boundable_styles() { $path = apf_classname_to_path(__CLASS__); return array_merge(parent::use_boundable_styles(), array($path . 'BrokerHome.css')); } public function get_actived_tab() { return 'home'; } public function get_sub_nav() { return null; }
protected function fetch_boundable_resources($class, $ext, $is_page = false) { if ($is_page) { apf_require_page($class); $path = "page/"; $class = $class . "Page"; } else { apf_require_component($class); $path = "component/"; $class = $class . "Component"; } if (!class_exists($class)) { return false; } eval("\$list = {$class}" . "::use_component();"); foreach ($list as $item) { $this->fetch_boundable_resources($item, $ext); } if ($ext == 'js') { eval("\$list = {$class}::use_boundable_javascripts();"); } elseif ($ext == 'css') { eval("\$list = {$class}::use_boundable_styles();"); } else { trigger_error("Unknown extention \"{$ext}\"", E_USER_WARNING); $list = array(); } $apf = APF::get_instance(); foreach ($list as $item) { $apf->prcess_resource_url($path, $item, $this->boundable_resources); } return true; //if (!$this->include_resource_file($item[0])) { // trigger_error("Unable to include resource \"".$item[0]."\"", E_USER_WARNING); //} }
<?php /** * Created by PhpStorm. * User: emily * Date: 8/31/15 * Time: 11:28 PM */ apf_require_page('CMS'); class Group_TestPage extends CMSPage { public static function use_boundable_styles() { $path = apf_classname_to_path(__CLASS__); return array_merge(parent::use_boundable_styles(), array($path . "Appeal.css")); } public static function use_boundable_javascripts() { $path = apf_classname_to_path(__CLASS__); return array_merge(parent::use_boundable_javascripts(), array($path . 'Test.js', $path . "ajaxfileupload.js")); } public function get_title() { $str = "安居客CMS系统"; return $str; } public function get_head_sections() { $sections = parent::get_head_sections(); return $sections; }
<?php apf_require_page('Base'); class IndexPage extends BasePage { public function get_view() { return 'Index'; } public function get_title() { return 'v2 Demo'; } public static function use_boundable_javascripts() { return array('Index.js'); } }