/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Addons(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Addons'])) { $model->attributes = $_POST['Addons']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }
public function populateDb() { $config = (require "/../config/cms.php"); extract($config); //addons //laracms $addon = new Addons(); $addon->addon_name = 'laracms'; $addon->addon_title = 'Core System Addon'; $addon->icon_image = 'http://laravel.com/assets/img/logo-head.png'; $addon->version = '1.0.1'; $addon->author = 'bonweb'; $addon->url = 'http://www.bonweb.gr'; $addon->installed = 1; $addon->save(); ClassLoader::addDirectories(array(public_path() . "/addons/laracms/controllers", public_path() . "/addons/laracms/models", public_path() . "/addons/laracms/helpers")); //add the screensaver setting $setting = new Settings(); $setting->area = 'backend'; $setting->section = 'laracms'; $setting->setting_name = 'screensaver'; $setting->setting_value = '60000'; $setting->autoload = 1; $setting->save(); //grid manager $addon = new Addons(); $addon->addon_name = 'grid_manager'; $addon->addon_title = 'Grid Manager'; $addon->icon_image = 'http://laravel.com/assets/img/logo-head.png'; $addon->version = '1.0.1'; $addon->author = 'bonweb'; $addon->url = 'http://www.bonweb.gr'; $addon->installed = 1; $addon->save(); ClassLoader::addDirectories(array(public_path() . "/addons/grid_manager/controllers", public_path() . "/addons/grid_manager/models", public_path() . "/addons/grid_manager/helpers")); require_once public_path() . "/addons/grid_manager/func.php"; Event::fire('backend.addons.saveaddoninfo.grid_manager', array($addon)); //themes $theme = new Themes(); $theme->theme_name = 'lara'; $theme->theme_title = 'LaraCMS Default Theme'; $theme->icon_image = 'http://laravel.com/assets/img/logo-head.png'; $theme->version = '1.0.1'; $theme->author = 'bonweb'; $theme->url = 'http://www.bonweb.gr'; $theme->installed = 1; $theme->active = 1; $theme->save(); //users $user = new User(); $user->firstname = 'John'; $user->lastname = 'Doe'; $user->email = $config['admin_email']; $user->is_admin = '1'; $pass = Commoner::generatePass('administrator', $config['admin_email']); $user->password = Hash::make($pass); $user->save(); $this->info('Your Password is:' . $pass); //add the languages $lang = new Languages(); $lang->code = 'en_US'; $lang->title = 'English'; $lang->image = "/uploads/flags/Englang.png"; $lang->active = 1; $lang->save(); $lang = new Languages(); $lang->code = 'el_GR'; $lang->title = 'Greek'; $lang->image = "/uploads/flags/Greece.png"; $lang->active = 1; $lang->save(); }
function saveAddoninfo($file, $source, $result) { //read the info and save the data $zip = new ZipArchive(); if ($zip->open($source . $file) !== TRUE) { } for ($i = 0; $i < $zip->numFiles; $i++) { $entry = explode("/", $zip->getNameIndex($i)); if (end($entry) == 'addon.xml') { $xml = $zip->getFromIndex($i); } } $xml = new SimpleXMLElement($xml); $addon = new Addons(); $addon->addon_name = $xml->name; $addon->addon_title = $xml->title; $addon->icon_image = $xml->image; $addon->version = $xml->version; $addon->author = $xml->author; $addon->url = $xml->url; $addon->installed = 0; $addon->save(); //require the func.php file to load the events to listen require_once public_path() . "/addons/{$addon->addon_name}/func.php"; Event::fire('backend.addons.saveaddoninfo.' . $addon->addon_name, array($addon)); }