mentel, on 30 April 2012 - 04:46 PM, said:
BTW: I did some research about slugs. Interesting concept, but not what I'm trying to accomplish.
Thank you!
Posted 30 April 2012 - 06:12 PM
jmariani, on 30 April 2012 - 05:59 PM, said:

Posted 30 April 2012 - 07:35 PM
mentel, on 30 April 2012 - 06:12 PM, said:
Posted 30 April 2012 - 08:14 PM

Posted 02 May 2012 - 11:02 AM
echo $form->dropDownList($model,'id',GxHtml::listDataEx($clients,'id','nameForList'));
$clientList = array();
foreach($clients as $client) {
$clientList[$client->id] = $client->nameForList();
}
echo $form->dropDownList($model,'id',$clientList);
--- a/protected/extensions/giix-components/GxHtml.php
+++ b/protected/extensions/giix-components/GxHtml.php
@@ -143,6 +143,8 @@ class GxHtml extends CHtml {
return $model->__toString();
else
return $defaultValue;
+ } elseif(method_exists($model, $attribute)) {
+ return $model->$attribute();
} else {
return parent::value($model, $attribute, $defaultValue);
}
Posted 02 May 2012 - 11:21 AM
fr0d0z, on 02 May 2012 - 11:02 AM, said:

Posted 02 May 2012 - 11:30 AM
Posted 02 May 2012 - 11:38 AM
fr0d0z, on 02 May 2012 - 11:30 AM, said:

Posted 02 May 2012 - 11:58 AM
Posted 02 May 2012 - 12:02 PM
fr0d0z, on 02 May 2012 - 11:58 AM, said:

Posted 03 May 2012 - 05:41 PM
Posted 03 May 2012 - 08:02 PM

Posted 10 May 2012 - 12:37 AM
CException PromoRewards and its behaviors do not have a method or closure named "label".
Posted 12 May 2012 - 07:26 PM
Junior - df9, on 13 May 2011 - 06:10 AM, said:
public function attributeLabels() {
return array(
'id' => Yii::t('app', 'ID'),
'SSN' => Yii::t('app', 'Ssn'),
'email' => Yii::t('app', 'Email'),
'First_Name' => Yii::t('app', 'First Name'),
'Middle_Initial' => Yii::t('app', 'Middle Initial'),
'Last_Name' => Yii::t('app', 'Last Name'),
'Address1' => Yii::t('app', 'Address1'),
'Address2' => Yii::t('app', 'Address2'),
'City' => Yii::t('app', 'City'),
'State' => Yii::t('app', 'State'),
'Postal_Code' => Yii::t('app', 'Postal Code'),
);
}public function attributeLabels() {
$oldLabels = parent::attributeLabels();
$newLabels = array(
'SSN' => Yii::t('app', 'SSN'),
);
return array_merge($oldLabels, $newLabels);
}
Posted 06 June 2012 - 05:20 PM

Posted 20 June 2012 - 03:11 PM
iScotts, on 19 March 2012 - 09:31 AM, said:
Posted 21 June 2012 - 04:43 PM
mentel, on 05 March 2012 - 02:12 PM, said:
Posted 06 July 2012 - 08:47 AM
Object Purchase ----- -------- id (PK) id (PK) name title Purchase_id (FK) price
CREATE TABLE "Object"(
"id" INTEGER PRIMARY KEY NOT NULL,
"name" VARCHAR(45),
"Purchase_id" INTEGER,
CONSTRAINT "fk_Object_Purchase"
FOREIGN KEY("Purchase_id")
REFERENCES "Purchase"("id")
);
CREATE INDEX "Object.fk_Object_Purchase" ON "Object"("Purchase_id");
CREATE TABLE "Purchase"(
"id" INTEGER PRIMARY KEY NOT NULL,
"title" VARCHAR(45),
"price" VARCHAR(45)
);<?php
class PurchaseController extends GxController {
public function actionView($id) {
$this->render('view', array(
'model' => $this->loadModel($id, 'Purchase'),
));
}
public function actionCreate() {
$model = new Purchase;
if (isset($_POST['Purchase'])) {
$model->setAttributes($_POST['Purchase']);
if ($model->save()) {
if (Yii::app()->getRequest()->getIsAjaxRequest())
Yii::app()->end();
else
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', array( 'model' => $model));
}
public function actionUpdate($id) {
$model = $this->loadModel($id, 'Purchase');
if (isset($_POST['Purchase'])) {
$model->setAttributes($_POST['Purchase']);
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('update', array(
'model' => $model,
));
}
public function actionDelete($id) {
if (Yii::app()->getRequest()->getIsPostRequest()) {
$this->loadModel($id, 'Purchase')->delete();
if (!Yii::app()->getRequest()->getIsAjaxRequest())
$this->redirect(array('admin'));
} else
throw new CHttpException(400, Yii::t('app', 'Your request is invalid.'));
}
public function actionIndex() {
$dataProvider = new CActiveDataProvider('Purchase');
$this->render('index', array(
'dataProvider' => $dataProvider,
));
}
public function actionAdmin() {
$model = new Purchase('search');
$model->unsetAttributes();
if (isset($_GET['Purchase']))
$model->setAttributes($_GET['Purchase']);
$this->render('admin', array(
'model' => $model,
));
}
}<?php
class ObjectController extends GxController {
public function actionView($id) {
$this->render('view', array(
'model' => $this->loadModel($id, 'Object'),
));
}
public function actionCreate() {
$model = new Object;
if (isset($_POST['Object'])) {
$model->setAttributes($_POST['Object']);
if ($model->save()) {
if (Yii::app()->getRequest()->getIsAjaxRequest())
Yii::app()->end();
else
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', array( 'model' => $model));
}
public function actionUpdate($id) {
$model = $this->loadModel($id, 'Object');
if (isset($_POST['Object'])) {
$model->setAttributes($_POST['Object']);
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('update', array(
'model' => $model,
));
}
public function actionDelete($id) {
if (Yii::app()->getRequest()->getIsPostRequest()) {
$this->loadModel($id, 'Object')->delete();
if (!Yii::app()->getRequest()->getIsAjaxRequest())
$this->redirect(array('admin'));
} else
throw new CHttpException(400, Yii::t('app', 'Your request is invalid.'));
}
public function actionIndex() {
$dataProvider = new CActiveDataProvider('Object');
$this->render('index', array(
'dataProvider' => $dataProvider,
));
}
public function actionAdmin() {
$model = new Object('search');
$model->unsetAttributes();
if (isset($_GET['Object']))
$model->setAttributes($_GET['Object']);
$this->render('admin', array(
'model' => $model,
));
}
}<div class="form">
<?php $form = $this->beginWidget('GxActiveForm', array(
'id' => 'purchase-form',
'enableAjaxValidation' => false,
));
?>
<p class="note">
<?php echo Yii::t('app', 'Fields with'); ?> <span class="required">*</span> <?php echo Yii::t('app', 'are required'); ?>.
</p>
<?php echo $form->errorSummary($model); ?>
<div class="row">
<?php echo $form->labelEx($model,'title'); ?>
<?php echo $form->textField($model, 'title', array('maxlength' => 45)); ?>
<?php echo $form->error($model,'title'); ?>
</div><!-- row -->
<div class="row">
<?php echo $form->labelEx($model,'price'); ?>
<?php echo $form->textField($model, 'price', array('maxlength' => 45)); ?>
<?php echo $form->error($model,'price'); ?>
</div><!-- row -->
<label><?php echo GxHtml::encode($model->getRelationLabel('objects')); ?></label>
<?php echo $form->checkBoxList($model, 'objects', GxHtml::encodeEx(GxHtml::listDataEx(Object::model()->findAllAttributes(null, true)), false, true)); ?>
<?php
echo GxHtml::submitButton(Yii::t('app', 'Save'));
$this->endWidget();
?>
</div><!-- form -->



Posted 09 July 2012 - 04:09 AM
<?php
abstract class BasePurchase extends GxActiveRecord {
public static function model($className=__CLASS__) {
return parent::model($className);
}
public function tableName() {
return 'Purchase';
}
public static function label($n = 1) {
return Yii::t('app', 'Purchase|Purchases', $n);
}
public static function representingColumn() {
return 'title';
}
public function rules() {
return array(
array('title, price', 'length', 'max'=>45),
array('title, price', 'default', 'setOnEmpty' => true, 'value' => null),
array('id, title, price', 'safe', 'on'=>'search'),
);
}
public function relations() {
return array(
'objects' => array(self::HAS_MANY, 'Object', 'Purchase_id'),
);
}
public function pivotModels() {
return array(
);
}
public function attributeLabels() {
return array(
'id' => Yii::t('app', 'ID'),
'title' => Yii::t('app', 'Title'),
'price' => Yii::t('app', 'Price'),
'objects' => null,
);
}
public function search() {
$criteria = new CDbCriteria;
$criteria->compare('id', $this->id);
$criteria->compare('title', $this->title, true);
$criteria->compare('price', $this->price, true);
return new CActiveDataProvider($this, array(
'criteria' => $criteria,
));
}
}
case GxActiveRecord::MANY_MANY:
return "echo \$form->checkBoxList(\$model, '{$relationName}', GxHtml::encodeEx(GxHtml::listDataEx({$relationModel}::model()->findAllAttributes(null, true)), false, true))";
break;
Posted 11 July 2012 - 05:04 PM
public function search($scopes = false) {
$dataProvider = parent::search();
if ($scopes) {
if (is_string($scopes))
$scopes = array($scopes);
$criteria = $dataProvider->getCriteria();
if (empty($criteria->scopes))
$criteria->scopes = $scopes;
elseif (is_array($criteria->scopes))
$criteria->scopes = array_merge($criteria->scopes, $scopes);
elseif (is_string($criteria->scopes))
$criteria->scopes = array_merge(array($criteria->scopes), $scopes);
$dataProvider->setCriteria($criteria);
}
return $dataProvider;
}