/
controller.php
62 lines (54 loc) · 1.89 KB
/
controller.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
namespace Concrete\Block\Testimonial;
defined('C5_EXECUTE') or die("Access Denied.");
use Concrete\Core\Block\BlockController;
use Core;
class Controller extends BlockController
{
public $helpers = array('form');
protected $btInterfaceWidth = 450;
protected $btCacheBlockOutput = true;
protected $btCacheBlockOutputOnPost = true;
protected $btCacheBlockOutputForRegisteredUsers = true;
protected $btInterfaceHeight = 560;
protected $btExportFileColumns = array('fID', 'awardImageID');
protected $btTable = 'btTestimonial';
public function getBlockTypeDescription()
{
return t("Displays a quote or paragraph next to biographical information and a person's picture.");
}
public function getBlockTypeName()
{
return t("Testimonial");
}
public function getSearchableContent()
{
return $this->name . "\n" . $this->position . "\n" . $this->company . "\n" . $this->paragraph;
}
public function view()
{
$image = false;
if ($this->fID) {
$f = \File::getByID($this->fID);
if (is_object($f)) {
$image = Core::make('html/image', array('f' => $f))->getTag();
$image->alt($this->name);
$this->set('image', $image);
}
}
$awardImage = false;
if ($this->awardImageID) {
$f = \File::getByID($this->awardImageID);
if (is_object($f)) {
$awardImage = Core::make('html/image', array('f' => $f))->getTag();
$this->set('awardImage', $awardImage);
}
}
}
public function save($args)
{
$args['fID'] = (isset($args['fID']) && $args['fID'] != '') ? $args['fID'] : 0;
$args['awardImageID'] = (isset($args['awardImageID']) && $args['awardImageID'] != '') ? $args['awardImageID'] : 0;
parent::save($args);
}
}