Ejemplo n.º 1
0
 public static function setCurrentTheme($x)
 {
     self::$set_theme = $x;
     $theme = new Theme(self::$set_theme);
     if ($theme->validate()) {
         self::$curr_theme = $theme;
     }
 }
Ejemplo n.º 2
0
 public function actionCreate()
 {
     $model = new Theme();
     $suc = Yii::t('info', 'The record was successfully created');
     $err = Yii::t('info', 'The record could not be created');
     $zip = new XUploadForm();
     $userZips = array();
     if (!isset($_POST[$this->modelName])) {
         Yii::app()->user->setState('images', NULL);
     }
     if (isset($_POST['Theme'])) {
         $model->attributes = $_POST['Theme'];
         $userZips = Yii::app()->user->getState('images');
         if ($model->validate()) {
             //$path = Yii::app()->runtimePath.'/dir/'.$model->zip;
             //$img->saveAs('dir/'.$model->name);
             $model->save();
             $path = $userZips[0]["path"];
             $this->unzipTheme($path, $model->name, UtilityHelper::yiiparam('frontPath') . "/www/themes");
             Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_SUCCESS, $suc);
             if (Yii::app()->getRequest()->getIsAjaxRequest()) {
                 $this->renderPartial('_view', array('model' => $model), false, true);
                 Yii::app()->end();
             } else {
                 $this->redirect(array('view', 'id' => $model->id));
             }
         } else {
             Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_ERROR, $err);
         }
         UtilityHelper::sendToLog($userZips);
     }
     if (Yii::app()->getRequest()->getIsAjaxRequest()) {
         $this->renderPartial('_form', array('model' => $model, 'zip' => $zip, 'userZips' => $userZips), false, true);
         Yii::app()->end();
     }
     $this->render('create', array('model' => $model, 'zip' => $zip, 'userZips' => $userZips));
 }
Ejemplo n.º 3
0
 public function getTheme()
 {
     if (!array_key_exists('theme', $this->info)) {
         $settings = (array) $this->getSettings();
         plugin('page_gettheme', array($settings));
         $settings = filter('page_gettheme', $settings);
         if (array_key_exists('theme', $settings)) {
             $theme = new Theme($settings['theme']);
             if ($theme->validate()) {
                 $this->info['theme'] = $theme->getName();
             }
         } else {
             $this->info['theme'] = Settings::get('site', 'theme', true);
         }
     }
     return filter('node_theme', $this->info['theme']);
 }
Ejemplo n.º 4
0
<?php

include_once "Theme.php";
include "theme_database.php";
$theme = new Theme();
$theme->theme = $_POST["theme"];
if ($theme->validate()) {
    echo "is valid";
    echo $theme->toString();
} else {
    echo "Try Again";
}
getConnection();
#insertTheme($theme-> theme = $_POST["theme"]);
#retrieveThemeById($id = 7);
#updateTheme($id = 7,$theme->theme = $_POST["theme"]);
deleteThemeById($id = 8);