Skip to content

Commit

Permalink
Work on ask module
Browse files Browse the repository at this point in the history
  • Loading branch information
voltan committed Jul 31, 2017
1 parent c8ada83 commit 3d3c220
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 11 deletions.
24 changes: 13 additions & 11 deletions sql/mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,19 @@ CREATE TABLE `{question}` (
);

CREATE TABLE `{project}` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`title` VARCHAR(255) NOT NULL DEFAULT '',
`slug` VARCHAR(255) NOT NULL DEFAULT '',
`text_description` TEXT,
`time_create` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`time_update` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`status` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
`seo_title` VARCHAR(255) NOT NULL DEFAULT '',
`seo_keywords` VARCHAR(255) NOT NULL DEFAULT '',
`seo_description` VARCHAR(255) NOT NULL DEFAULT '',
`manager` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`title` VARCHAR(255) NOT NULL DEFAULT '',
`slug` VARCHAR(255) NOT NULL DEFAULT '',
`text_description` TEXT,
`time_create` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`time_update` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`status` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
`seo_title` VARCHAR(255) NOT NULL DEFAULT '',
`seo_keywords` VARCHAR(255) NOT NULL DEFAULT '',
`seo_description` VARCHAR(255) NOT NULL DEFAULT '',
`manager` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`main_image` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`additional_images` TEXT,
PRIMARY KEY (`id`),
KEY `title` (`title`),
KEY `status` (`status`),
Expand Down
10 changes: 10 additions & 0 deletions src/Form/AskFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ public function __construct()
),
),
));
//main_image
$this->add(array(
'name' => 'main_image',
'required' => false,
));
// additional_images
/* $this->add(array(
'name' => 'additional_images',
'required' => false,
)); */
// tag
if (Pi::service('module')->isActive('tag')) {
$this->add(array(
Expand Down
26 changes: 26 additions & 0 deletions src/Form/AskForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,32 @@ public function init()
'description' => '',
)
));
// main_image
$this->add(array(
'name' => 'main_image',
'type' => 'Module\Media\Form\Element\Media',
'options' => array(
'label' => __('Main image'),
'media_gallery' => false,
'media_season' => false,
'media_season_recommended' => false,
'is_freemium' => true,
'can_connect_lists' => false,
),
));
// additional_images
/* $this->add(array(
'name' => 'additional_images',
'type' => 'Module\Media\Form\Element\Media',
'options' => array(
'label' => __('Additional images'),
'media_gallery' => true,
'media_season' => false,
'media_season_recommended' => false,
'is_freemium' => true,
'can_connect_lists' => false,
),
)); */
// tag
if (Pi::service('module')->isActive('tag')) {
$this->add(array(
Expand Down
10 changes: 10 additions & 0 deletions src/Form/ProjectFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ public function __construct()
),
),
));
//main_image
$this->add(array(
'name' => 'main_image',
'required' => false,
));
// additional_images
$this->add(array(
'name' => 'additional_images',
'required' => false,
));
// status
$this->add(array(
'name' => 'status',
Expand Down
26 changes: 26 additions & 0 deletions src/Form/ProjectForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,32 @@ public function init()
'description' => '',
)
));
// main_image
$this->add(array(
'name' => 'main_image',
'type' => 'Module\Media\Form\Element\Media',
'options' => array(
'label' => __('Main image'),
'media_gallery' => false,
'media_season' => false,
'media_season_recommended' => false,
'is_freemium' => true,
'can_connect_lists' => false,
),
));
// additional_images
$this->add(array(
'name' => 'additional_images',
'type' => 'Module\Media\Form\Element\Media',
'options' => array(
'label' => __('Additional images'),
'media_gallery' => true,
'media_season' => false,
'media_season_recommended' => false,
'is_freemium' => true,
'can_connect_lists' => false,
),
));
// status
$this->add(array(
'name' => 'status',
Expand Down
2 changes: 2 additions & 0 deletions src/Model/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,7 @@ class Project extends Model
'seo_keywords',
'seo_description',
'manager',
'main_image',
'additional_images',
);
}
1 change: 1 addition & 0 deletions template/front/question-list.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<div class="clearfix">
<?php echo $project['text_description']; ?>
</div>
<?php echo Pi::api('doc','media')->getSingleLinkUrl($project['main_image'])->thumb('thumbnail'); ?>
<?php } else { ?>
<div class="page-header clearfix">
<h1 class="pull-left"><?php echo $this->escape($title); ?></h1>
Expand Down

0 comments on commit 3d3c220

Please sign in to comment.