Skip to content

Commit

Permalink
Dev: extends_templates_name should be extends. Really.
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Oct 13, 2017
1 parent 40f726d commit 20969e5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions application/models/Template.php
Expand Up @@ -33,7 +33,7 @@
* @property string $description
* @property string $last_update
* @property integer $owner_id
* @property string $extends_templates_name
* @property string $extends
*/
class Template extends LSActiveRecord
{
Expand Down Expand Up @@ -62,14 +62,14 @@ public function rules()
return array(
array('name, title, creation_date', 'required'),
array('owner_id', 'numerical', 'integerOnly'=>true),
array('name, author, extends_templates_name', 'length', 'max'=>150),
array('name, author, extends', 'length', 'max'=>150),
array('folder, version, api_version, view_folder, files_folder', 'length', 'max'=>45),
array('title', 'length', 'max'=>100),
array('author_email, author_url', 'length', 'max'=>255),
array('copyright, license, description, last_update', 'safe'),
// The following rule is used by search().
// @todo Please remove those attributes that should not be searched.
array('name, folder, title, creation_date, author, author_email, author_url, copyright, license, version, api_version, view_folder, files_folder, description, last_update, owner_id, extends_templates_name', 'safe', 'on'=>'search'),
array('name, folder, title, creation_date, author, author_email, author_url, copyright, license, version, api_version, view_folder, files_folder, description, last_update, owner_id, extends', 'safe', 'on'=>'search'),
);
}

Expand Down Expand Up @@ -105,7 +105,7 @@ public function attributeLabels()
'description' => 'Description',
'last_update' => 'Last Update',
'owner_id' => 'Owner',
'extends_templates_name' => 'Extends Templates Name',
'extends' => 'Extends Templates Name',
);
}

Expand Down Expand Up @@ -498,7 +498,7 @@ public function search()
$criteria->compare('description',$this->description,true);
$criteria->compare('last_update',$this->last_update,true);
$criteria->compare('owner_id',$this->owner_id);
$criteria->compare('extends_templates_name',$this->extends_templates_name,true);
$criteria->compare('extends',$this->extends,true);

return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
Expand Down
10 changes: 5 additions & 5 deletions application/models/TemplateConfiguration.php
Expand Up @@ -327,7 +327,7 @@ public static function importManifest($sTemplateName)
$oNewTemplate->files_folder = $oEditTemplateDb->files_folder;
//$oNewTemplate->description TODO: a more complex modal whith email, author, url, licence, desc, etc
$oNewTemplate->owner_id = Yii::app()->user->id;
$oNewTemplate->extends_templates_name = $oEditedTemplate->oMotherTemplate->sTemplateName;
$oNewTemplate->extends = $oEditedTemplate->oMotherTemplate->sTemplateName;

if ($oNewTemplate->save()){
$oNewTemplateConfiguration = new TemplateConfiguration;
Expand Down Expand Up @@ -559,8 +559,8 @@ protected function removeFileFromPackage( $sPackageName, $sType, $aSettings )
*/
protected function setMotherTemplates()
{
if(!empty($this->template->extends_templates_name)){
$sMotherTemplateName = $this->template->extends_templates_name;
if(!empty($this->template->extends)){
$sMotherTemplateName = $this->template->extends;
$this->oMotherTemplate = TemplateConfiguration::getInstanceFromTemplateName($sMotherTemplateName);
$this->oMotherTemplate->prepareTemplateRendering($sMotherTemplateName, null);
if ($this->oMotherTemplate->checkTemplate()){
Expand Down Expand Up @@ -640,8 +640,8 @@ protected function getOptionKey($key){

protected function addMotherTemplatePackage($packages)
{
if (!empty($this->template->extends_templates_name)){
$sMotherTemplateName = (string) $this->template->extends_templates_name;
if (!empty($this->template->extends)){
$sMotherTemplateName = (string) $this->template->extends;
$packages[] = 'survey-template-'.$sMotherTemplateName;
}
return $packages;
Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/templateoptions/index.php
Expand Up @@ -56,7 +56,7 @@
array(
'header' => gT('extends'),
'name' => 'templates_extends',
'value'=>'$data->template->extends_templates_name',
'value'=>'$data->template->extends',
'htmlOptions' => array('class' => 'col-md-2'),
),

Expand Down

0 comments on commit 20969e5

Please sign in to comment.