function addlang() { $lang = new Languages(); $lang->code = Input::get('code'); $lang->title = Input::get('title'); $lang->image = Input::get('image_url'); $lang->save(); return Redirect::to("languages/manage")->withMessage($this->notifyView(Lang::get('messages.lang_created'), 'success')); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Languages(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Languages'])) { $model->attributes = $_POST['Languages']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->idLanguages)); } } $this->render('create', array('model' => $model)); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { try { $model = new Languages(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Languages'])) { $model->attributes = $_POST['Languages']; if ($model->save()) { Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_SUCCESS, '<strong>Well!</strong> Language created with sucess!'); Yii::app()->controller->refresh(); } } } catch (Exception $e) { Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_ERROR, '<strong>Ops!</strong> ERROR!'); Yii::app()->controller->refresh(); } $this->render('create', array('model' => $model)); }
public function actionLcreate() { $model=new Languages; // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if(isset($_POST['Languages'])) { $model->attributes=$_POST['Languages']; if($model->save()) $this->redirect(array('ladmin')); } $test=array('guide'=>$this->loadContact(Yii::app()->user->cid),'tours'=>$this->loadTours(),'todo'=>$this->loadUnreported()); $this->render('lcreate',array( 'info'=>$test, '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(); }
public function actionUpdateLng() { /* @var $language Languages */ $id = Yii::app()->request->getParam('id', null); $label = Yii::app()->request->getParam('label', ''); $prefix = Yii::app()->request->getParam('prefix', DEFAULT_LANGUAGE); $status = Yii::app()->request->getParam('status', Constants::STATUS_VISIBLE); $original_name = Yii::app()->request->getParam('original_name', ''); $english_name = Yii::app()->request->getParam('english_name', ''); $russian_name = Yii::app()->request->getParam('russian_name', ''); $notification = Yii::app()->request->getParam('notification', ''); $language = Languages::model()->findByPk($id); if ($language == null) { $language = new Languages(); } $language->label = $label; $language->prefix = strtolower(substr($prefix, 0, 2)); $language->notification = strtoupper(substr($notification, 0, 2)); $language->status = $status; $language->original_language_name = $original_name; $language->english_language_name = $english_name; $language->russian_language_name = $russian_name; if ($language->isNewRecord) { $language->priority = DwHelper::getNextPriority("Languages"); $language->save(); } else { $language->update(); } $this->redirect($this->createUrl('/admin/panel/languages')); }