public function __construct($className, array $options) { parent::__construct($className); $this->_options = $options; $this->setPhpDoc(array('Route prefix handler for ' . strtolower($this->_options['title_plural']) . ' in the public system.')); $this->setImplements('XenForo_Route_Interface'); $this->_createFunctionMatch(); $this->_createFunctionBuildLink(); }
public function __construct($className, array $options) { parent::__construct($className); if (empty($options['name'])) { $options['name'] = substr(strrchr($className, '_'), 1); } $this->setExtends('XenForo_DataWriter'); $this->_createFunctionGetFields($options); $this->_createFunctionGetExistingData($options); $this->_createFunctionGetUpdateCondition($options); $this->_createFunctionGetModel($options); }
public function __construct($className, array $options) { parent::__construct($className); $this->setExtends('XenForo_ControllerAdmin_Abstract'); $this->_dataWriter = XenForo_DataWriter::create($options['datawriter']); if (empty($options['name'])) { $options['name'] = substr(strrchr($className, '_'), 1); } if (empty($options['name_plural'])) { $options['name_plural'] = substr($options['method'], 3); } if (empty($options['view_class'])) { $options['view_class'] = substr($className, 0, strpos($className, '_ControllerAdmin_') + 1) . 'View' . substr($className, strpos($className, '_ControllerAdmin_') + 11); } if (in_array('index', $options['actions'])) { $this->_createFunctionActionIndex($options); } if (in_array('add', $options['actions']) || in_array('edit', $options['actions'])) { $this->_createFunctionGetAddEditResponse($options); } if (in_array('add', $options['actions'])) { $this->_createFunctionActionAdd($options); } if (in_array('edit', $options['actions'])) { $this->_createFunctionActionEdit($options); } if (in_array('add', $options['actions']) || in_array('edit', $options['actions'])) { $this->_createFunctionActionSave($options); } if (in_array('delete', $options['actions'])) { $this->_createFunctionActionDelete($options); } if (in_array('edit', $options['actions'])) { $this->_createFunctionGetOrError($options); } if (in_array('index', $options['actions'])) { $this->_createFunctionGetModel($options); } }
public function actionSave() { $input = $this->_input->filter(array('class' => XenForo_Input::STRING, 'addon_id' => XenForo_Input::STRING)); $phpFile = new ThemeHouse_PhpFile($input['addon_id'] . '_Model_' . $input['class']); $phpFile->setExtends('XenForo_Model'); $phpFile->export(); $model = array('class' => $input['addon_id'] . '_Model_' . $input['class']); XenForo_Helper_Cookie::setCookie('edit_addon_id', $input['addon_id']); return $this->responseRedirect(XenForo_ControllerResponse_Redirect::RESOURCE_CREATED, XenForo_Link::buildAdminLink('models', $model)); }