The followings are the available columns in table 'length_class_description':
Inheritance: extends CActiveRecord
Example #1
0
 public function actionUpdate($id)
 {
     $model = new SettingsForm();
     if (isset($_POST['SettingsForm'])) {
         $model->attributes = $_POST['SettingsForm'];
         if ($model->validate() && $model->save()) {
             $this->redirect(array('index'));
         }
     } else {
         $model->loadDataFromStore($id);
     }
     $directories = glob(Yii::getPathOfAlias('webroot.themes') . "/*", GLOB_ONLYDIR);
     $themes = array();
     foreach ($directories as $directory) {
         $themes[] = basename($directory);
     }
     $layouts = CHtml::listData(Layout::model()->findAll(), 'layout_id', 'name');
     $countries = CHtml::listData(Country::model()->findAll(), 'country_id', 'name');
     $zones = CHtml::listData(Zone::model()->findAllByAttributes(array('country_id' => $model->country)), 'zone_id', 'name');
     $languages = CHtml::listData(Language::model()->findAll(), 'language_id', 'name');
     $currencies = CHtml::listData(Currency::model()->findAll(), 'currency_id', 'title');
     $yesNoOptions = array(0 => Yii::t('settings', 'No'), 1 => Yii::t('settings', 'Yes'));
     $lengthClasses = CHtml::listData(LengthClassDescription::model()->findAll(), 'length_class_id', 'title');
     $weightClasses = CHtml::listData(WeightClassDescription::model()->findAll(), 'weight_class_id', 'title');
     $taxesOptions = array("" => Yii::t("settings", "--- None ---"), "shipping" => Yii::t("settings", "Shipping Address"), "payment" => Yii::t("settings", "Payment Address"));
     $customerGroups = CHtml::listData(CustomerGroupDescription::model()->findAll(), 'customer_group_id', 'name');
     $informations = array_merge(array(0 => Yii::t("settings", "--- None ---")), CHtml::listData(InformationDescription::model()->findAll(), 'information_id', 'title'));
     // TODO: localisation
     $orderStatuses = CHtml::listData(OrderStatus::model()->findAllByAttributes(array('language_id' => 1)), 'order_status_id', 'name');
     // TODO: localisation
     $returnStatuses = CHtml::listData(ReturnStatus::model()->findAllByAttributes(array('language_id' => 1)), 'return_status_id', 'name');
     $mailProtocols = array("mail" => Yii::t("settings", "Mail"), "smtp" => Yii::t("settings", "SMTP"));
     $this->render('update', array('model' => $model, 'themes' => $themes, 'layouts' => $layouts, 'countries' => $countries, 'zones' => $zones, 'languages' => $languages, 'currencies' => $currencies, 'yesNoOptions' => $yesNoOptions, 'lengthClasses' => $lengthClasses, 'weightClasses' => $weightClasses, 'taxesOptions' => $taxesOptions, 'customerGroups' => $customerGroups, 'informations' => $informations, 'orderStatuses' => $orderStatuses, 'returnStatuses' => $returnStatuses, 'mailProtocols' => $mailProtocols));
 }
 public function actionCreate()
 {
     $model = new LengthClass();
     $description = new LengthClassDescription();
     $this->performAjaxValidation(array($model, $description), 'length-class-form');
     if (isset($_POST[$this->modelName])) {
         $model->setAttributes($_POST[$this->modelName]);
         $description->setAttributes($_POST[$this->modelName . 'Description']);
         $suc = Yii::t('info', 'LengthClass was successfully created');
         $err = Yii::t('info', 'Could not update LengthClass');
         $description->length_class_id = 0;
         $description->locale_code = Yii::app()->getLanguage();
         if ($model->validate() && $description->validate()) {
             if ($model->save()) {
                 $description->length_class_id = $model->id;
                 $description->save();
                 Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_SUCCESS, $suc);
                 if (Yii::app()->getRequest()->getIsAjaxRequest()) {
                     $this->renderPartial('_view', array('model' => $model, 'description' => $description), false, true);
                     Yii::app()->end();
                 } else {
                     $this->redirect(array('view', 'id' => $model->id));
                 }
             } else {
                 Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_ERROR, $err);
             }
         } else {
             $description->validate();
         }
     }
     if (Yii::app()->getRequest()->getIsAjaxRequest()) {
         $this->renderPartial('_form', array('model' => $model, 'description' => $description), false, true);
         Yii::app()->end();
     }
     $this->render('create', array('model' => $model, 'description' => $description));
 }