/** * 验证通过后运行数据层 */ protected static function _run() { $actionName = SuiShiPHPConfig::getAction(); $method = SuiShiPHPConfig::getMethod(); define("__ACTION_NAME__", $actionName); define("__ACTION_METHOD__", $method); define("__APP_GROUP__", SuiShiPHPConfig::getAppGroup()); if (SuiShiPHPConfig::getAppGroup()) { $actionName = SuiShiPHPConfig::getAppGroup() . '.' . $actionName; } $action = loadAction($actionName); if (! $action || ! method_exists($action, $method)) { if (SuiShiPHPConfig::get('DEBUGGING') === true) { Logger::error('_run error: action not exist, action: '.__ACTION_NAME__.', method: '.__ACTION_METHOD__, HttpRequest::get()); throw new Exception('action not exist, action: '.__ACTION_NAME__.', method: '.__ACTION_METHOD__); } else { Logger::error('_run error: action not exist, action: '.__ACTION_NAME__.', method: '.__ACTION_METHOD__, HttpRequest::get()); myExit(); //TODO () 转向到404 页面 } } $action->$method(HttpRequest::get()); }
function runAction($controllerObj) { if (isset($_GET["action"]) && method_exists($controllerObj, $_GET["action"])) { loadAction($controllerObj, $_GET["action"]); } else { loadAction($controllerObj, 'index'); } }
<? loadAction( "BASE_ctrl_MapSearch" ); /** * map search controls * * @permission ACO="Usage"->"View" AXO="website"->"public" * */ class ctrl_MapSearch extends BASE_ctrl_MapSearch{ protected function tour_custom_titles() { return array( "left_column_title" => "Driving Tour", "right_column_title" => "Driving Directions", "print_title" => "Driving Tour & Driving Directions", "open_blurb" => "" ); } }
<?php /** * Open House * * @permission ACO="Usage"->"View" AXO="website"->"public" * */ loadAction("BASE_ctrl_OpenHouse"); class ctrl_OpenHouse extends BASE_ctrl_OpenHouse { protected function getClientSpecificArgs() { //build out open house dates $date_list = array(); $date_list['today'] = date("l"); if (date("l") == "Saturday") { $sat_time = time(); $date_list['sat_time'] = $sat_time; } else { $sat_time = strtotime("next saturday"); $date_list['sat_time'] = $sat_time; } if (date("l") == "Sunday") { $sun_time = time(); $date_list['sun_time'] = $sun_time; } else { $sun_time = strtotime("next sunday"); $date_list['sun_time'] = $sun_time; } if (date("l") !== "Saturday" && date("l") !== "Sunday") {
<? loadAction( "BASE_ctrl_Content" ); abstract class ctrl_Content extends BASE_ctrl_Content { protected function hasAdditionalHeaderArgs() { return true; } protected function getAdditionalHeaderArgs($tpl_args) { $jquery_output = ""; $jquery_libs = array(); $jquery_libs[] = "/js/libs/jquery/jquery.js"; $jquery_libs[] = "/js/validation/jquery.validate.min.js"; $jquery_libs[] = "/js/fancy_box/jquery.fancybox.latest.pack.js"; $jquery_libs[] = "/js/lib/jquery.openid.js"; if (!empty($jquery_libs)) { $jquery_output .= "\t<script src=\"/js/buildlist.js?scripts=" . implode(',', $jquery_libs) . "\"></script>\n"; } // set up the global booj object and add any configs here. $args = array( 'application_key' => defined('REST_API_KEY') ? REST_API_KEY : false, 'current_user' => !empty($this->elements['current_account_user']) ? $this->elements['current_account_user']['id'] : false, ); $jquery_output .= "\n\t<script>window.booj=" . json_encode($args) . "</script>\n";
<? loadAction( "BASE_ctrl_Home" ); class ctrl_Home extends BASE_ctrl_Home { /** * Override so we don't load any components on the page */ protected function __default() { $this->elements['PAGE_SIDEBARS']['default'] = null; $tpl_args = array(); $renderer = $this->getSmarty(); if (self::$isMobile) { $this->layout = getView('site', 'mobile', 'tpl'); $renderer->render(array(get_class($this->INT), "index.mobile"), $tpl_args); } else { $renderer->render(array(get_class($this->INT), "index"), $tpl_args); } } /** * Override so we don't load any components on the page */ protected function __rebrand_realtor($view) { $this->elements['PAGE_SIDEBARS']['default'] = null; $this->elements['SEO_ENGINE_OPTIMIZER']->SetPageTitle(SwitchBoard::$siteOwner->get_site_owner()->get_name()); $tpl_args = array();
<? loadAction( "BASE_ctrl_Search" ); /** * search controls * * @permission ACO="Usage"->"View" AXO="website"->"public" * */ class ctrl_Search extends BASE_ctrl_Search{ /** * @return boolean Return true to use the new search narrowers v2 method. */ protected function useSearchNarrowersV2() { return true; } /** * @return boolean Return true to add realors and teams. */ protected function getRealtorsTeams() { return true; } /** * @return array returns modifed array with overrides for the client */ protected function getAdditionalSearchNarrowerV2Args($search_narrowers = array()) { //build out open house dates $this->elements['open_house_dates'] = $this->getOpenHouseDates(); return $search_narrowers; }
<? loadAction("BASE_ctrl_PropertyComparison"); class ctrl_PropertyComparison extends BASE_ctrl_PropertyComparison { public function __construct( array $overrides=null ){ $this->layout = defined('SITE_LAYOUT')? SITE_LAYOUT : null; $this->INT = $this; } public function index() { $args = func_get_args(); $tpl_args = call_user_func_array(array($this, 'compare_by_session'), $args); $this->elements['USE_FULL_LAYOUT_FLAG'] = true; $renderer = $this->getSmarty(); $renderer->render( array(get_class($this->INT), "index"), $tpl_args); } }
<? loadAction( "BASE_ctrl_Realtor" ); /** * search controls * * @permission ACO="Usage"->"View" AXO="website"->"public" * */ class ctrl_Realtor extends BASE_ctrl_Realtor{ protected function __parse_filters() { $filters = parent::__parse_filters(); if( isset($_REQUEST['designation']) && $_REQUEST['designation'] != '' ) { $filters['realtor_info']['Designations'] = $_REQUEST['designation']; } return $filters; } protected function __get_additional_filter_args() { loadModel("entities/info_lists/RealtorInformation"); return array( 'designations' => explode('`,`', trim(RealtorInformation::GetInfoValuesByName('Designations'), '`')), 'spoken_languages' => explode('`,`', trim(RealtorInformation::GetInfoValuesByName('Spoken Languages'), '`')), ); } protected function getDynamicDictionaryDef() {
function A ($action) { return loadAction($action); }
<? loadAction("BASE_ctrl_Property"); class ctrl_Property extends BASE_ctrl_Property{ protected function addAdditionalArgs( $tpl_args ){ // get recent properties if ($account_user = EntityAggregator::GetCurrent()->getEntity(EntityType::ACCOUNT_USER)) { } else { $account_user = EntityAggregator::GetCurrent()->getEntity(EntityType::ANONYMOUS_USER); } $recent_properties = $account_user->getRecentItemsByType(RecentItemsTypes::PROPERTY)->getItems(); $tpl_args['recent_properties'] = array(); foreach ($recent_properties as $recent_prop) { $recent_prop->load_info(PropertyLoadLevel::IDX_SUMMARY); $tpl_args['recent_properties'][] = $recent_prop->getAsDictionary(); } // get property notes loadModel( '/entities/EntityAggregator' ); if( $account_user instanceof AccountUser ){ loadModel( '/property/FavoriteProperty' ); try{ $favProp = new FavoriteProperty( $account_user->get_id(), $tpl_args['company_property_id'] ); $tpl_args['enterprise_account_note'] = $favProp->notes; } catch( Exception $e ){ //Not a fav property. } }