public function before() { // Make sure we call the parent package before function parent::before(); // Load the config file for this package \Subpackage\Subconfig::subload(static::$_configFile, true); // Now set the view directory for this package static::$_viewPath = \Subpackage\Subconfig::get(static::$_configFile . '.view_directory'); }
public function action_add_letterhead() { $validation = Validation::forge(); if ($validation->run()) { $config = array('path' => \Subpackage\Subconfig::get(static::$_configFile . '.letterhead_directory'), 'randomize' => true, 'ext_whitelist' => array('pdf')); Upload::process($config); if (Upload::is_valid()) { Upload::save(); $filename = Upload::get_files(); $insertID = Model_Letterhead::create(Input::post('letterhead_title'), Input::post('letterhead_description'), Input::post('letterhead_company'), $filename[0]['saved_as'], array('top' => Input::post('letterhead_margin_top'), 'bottom' => Input::post('letterhead_margin_bottom'), 'left' => Input::post('letterhead_margin_left'), 'right' => Input::post('letterhead_margin_right')), Input::post('letterhead_product')); print "Added Letterhead with ID: " . $insertID; } } $this->template->title = 'Add Letterhead : Letter Management'; $this->template->content = View::forge(static::$_viewPath . 'manage/add_letterhead.php', array('companies' => \Crm\Company\Company_model::companyList())); }