This repository has been archived by the owner on May 19, 2021. It is now read-only.
/
societytopic.class.php
56 lines (45 loc) · 1.64 KB
/
societytopic.class.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
<?php
require_once MODX_CORE_PATH.'model/modx/modresource.class.php';
class SocietyTopic extends modResource {
public $showInContextMenu = true;
public $allowChildrenResources = false;
public $TopicAttributes;
function __construct(xPDO & $xpdo) {
parent :: __construct($xpdo);
}
public static function getControllerPath(xPDO &$modx) {
$path = $modx->getOption('modsociety.controller_path',null);
if(empty($path)){
$path = $modx->getOption('modsociety.core_path',null,
$modx->getOption('core_path', null ). 'components/modsociety/')
.'controllers/mgr/';
}
$path .= "societytopic/";
return $path;
}
public function getContextMenuText() {
$this->xpdo->lexicon->load('modsociety:resources');
return array(
'text_create' => $this->xpdo->lexicon('modsociety_topic_resource_create'),
'text_create_here' => $this->xpdo->lexicon('modsociety_topic_resource_create_here'),
);
}
public function getResourceTypeName() {
$this->xpdo->lexicon->load('modsociety:resources');
return $this->xpdo->lexicon('modsociety_topic_resource');
}
function get($k, $format = NULL, $formatTemplate = NULL){
switch($k){
case 'url':
return $this->makeUrl();
break;
}
return parent::get($k, $format, $formatTemplate);
}
function makeUrl(){
if(!$id = $this->get('id')){
return false;
}
return $this->xpdo->getOption('base_url')."topics/{$id}/";
}
}