diff options
Diffstat (limited to 'h-source/Application/Controllers/MeetController.php')
-rw-r--r-- | h-source/Application/Controllers/MeetController.php | 109 |
1 files changed, 73 insertions, 36 deletions
diff --git a/h-source/Application/Controllers/MeetController.php b/h-source/Application/Controllers/MeetController.php index 5395a21..808b951 100644 --- a/h-source/Application/Controllers/MeetController.php +++ b/h-source/Application/Controllers/MeetController.php @@ -32,12 +32,12 @@ class MeetController extends BaseController parent::__construct($model, $controller, $queryString); $this->model('ProfileModel'); - $this->model('UsersModel'); $this->model('HardwareModel'); $this->model('IssuesModel'); $this->model('MessagesModel'); $this->model('TalkModel'); $this->model('WikiModel'); + $this->model('WikitalkModel'); $argKeys = array( 'page:forceNat' => 1, @@ -49,23 +49,6 @@ class MeetController extends BaseController $this->append($data); } - //check if the users exists - private function userExists($user) - { - $clean['user'] = ctype_alnum($user) ? sanitizeAll($user) : ''; - - if (strcmp($clean['user'],'') !== 0) - { - $res = $this->m['UsersModel']->db->select('regusers','has_confirmed,deleted,username','username="'.$clean['user'].'" and has_confirmed=0 and deleted="no"'); - - if (count($res) > 0) - { - return true; - } - } - return false; - } - //public page of the user public function user($lang = 'en', $user = '') { @@ -74,7 +57,7 @@ class MeetController extends BaseController $this->shift(2); - if ($this->userExists($clean['user'])) + if ($this->m['UsersModel']->userExists($clean['user'])) { $clean['id_user'] = (int)$this->m['UsersModel']->getUserId($clean['user']); $data['meet_id_user'] = $clean['id_user']; @@ -106,7 +89,7 @@ class MeetController extends BaseController $this->shift(2); - if ($this->userExists($clean['user'])) + if ($this->m['UsersModel']->userExists($clean['user'])) { $clean['id_user'] = (int)$this->m['UsersModel']->getUserId($clean['user']); @@ -120,15 +103,18 @@ class MeetController extends BaseController $messNumb = $this->m['MessagesModel']->select('id_mes,messages.id_issue,messages.creation_date')->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->rowNumber(); - $talkNumb = $this->m['TalkModel']->select('talk.title')->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->rowNumber(); + $talkNumb = $this->m['TalkModel']->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->rowNumber(); + + $wikiNumb = $this->m['WikiModel']->where($this->whereArray)->rowNumber(); - $wikiNumb = $this->m['WikiModel']->select()->where($this->whereArray)->rowNumber(); + $wikiTalkNumb = $this->m['WikitalkModel']->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->rowNumber(); $data['hasHardware'] = $hardNumb > 0 ? true : false; $data['hasIssues'] = $issuesNumb > 0 ? true : false; $data['hasMessages'] = $messNumb > 0 ? true : false; $data['hasTalk'] = $talkNumb > 0 ? true : false; $data['hasWiki'] = $wikiNumb > 0 ? true : false; + $data['hasWikiTalk'] = $wikiTalkNumb > 0 ? true : false; $this->append($data); $this->load('contributions'); @@ -145,7 +131,7 @@ class MeetController extends BaseController $this->shift(2); - if ($this->userExists($clean['user'])) + if ($this->m['UsersModel']->userExists($clean['user'])) { $this->whereArray['username'] = $clean['user']; @@ -153,8 +139,11 @@ class MeetController extends BaseController $data['meet_username'] = $clean['user']; + $data['tree_last_string'] = "hardware contributions"; + $data['page_explanation_title'] = "hardware contributions of"; + $this->append($data); - $this->load('hardware'); + $this->load('list_template'); $this->right(); } @@ -168,7 +157,7 @@ class MeetController extends BaseController $this->shift(2); - if ($this->userExists($clean['user'])) + if ($this->m['UsersModel']->userExists($clean['user'])) { //load the Pages helper $this->helper('Pages','meet/issues/'.$this->lang.'/'.$clean['user'],'page'); @@ -188,8 +177,11 @@ class MeetController extends BaseController $data['meet_username'] = $clean['user']; + $data['tree_last_string'] = "issues opened"; + $data['page_explanation_title'] = "issues opened by"; + $this->append($data); - $this->load('issues'); + $this->load('list_template'); $this->right(); } @@ -203,7 +195,7 @@ class MeetController extends BaseController $this->shift(2); - if ($this->userExists($clean['user'])) + if ($this->m['UsersModel']->userExists($clean['user'])) { //load the Pages helper $this->helper('Pages','meet/messages/'.$this->lang.'/'.$clean['user'],'page'); @@ -221,30 +213,33 @@ class MeetController extends BaseController $data['meet_username'] = $clean['user']; + $data['tree_last_string'] = "messages submitted"; + $data['page_explanation_title'] = "messages submitted by"; + $data['pageList'] = $this->h['Pages']->render($page-3,7); $this->append($data); - $this->load('messages'); + $this->load('list_template'); $this->right(); } } - //messages in the talk page + //messages in the talk page of the devices public function talk($lang = 'en', $user = '') { $clean['user'] = ctype_alnum($user) ? sanitizeAll($user) : ''; - $data['title'] = "messages submitted - ".Website::$generalName; + $data['title'] = "talk messages submitted - ".Website::$generalName; $this->shift(2); - if ($this->userExists($clean['user'])) + if ($this->m['UsersModel']->userExists($clean['user'])) { //load the Pages helper $this->helper('Pages','meet/talk/'.$this->lang.'/'.$clean['user'],'page'); $clean['id_user'] = (int)$this->m['UsersModel']->getUserId($clean['user']); - $this->m['TalkModel']->from('talk inner join hardware')->using('id_hard')->select('talk.title,talk.creation_date,talk.id_hard,talk.id_talk,hardware.type')->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->orderBy('id_talk desc'); + $this->m['TalkModel']->inner('hardware')->using('id_hard')->select('talk.*,hardware.*')->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->orderBy('id_talk desc'); $recordNumber = $this->m['TalkModel']->rowNumber(); $page = $this->viewArgs['page']; @@ -255,10 +250,13 @@ class MeetController extends BaseController $data['meet_username'] = $clean['user']; + $data['tree_last_string'] = "talk messages (hardware pages)"; + $data['page_explanation_title'] = "talk messages (hardware pages) submitted by"; + $data['pageList'] = $this->h['Pages']->render($page-3,7); $this->append($data); - $this->load('talk'); + $this->load('list_template'); $this->right(); } } @@ -271,7 +269,7 @@ class MeetController extends BaseController $this->shift(2); - if ($this->userExists($clean['user'])) + if ($this->m['UsersModel']->userExists($clean['user'])) { //load the Pages helper $this->helper('Pages','meet/wiki/'.$this->lang.'/'.$clean['user'],'page'); @@ -289,13 +287,52 @@ class MeetController extends BaseController $data['meet_username'] = $clean['user']; + $data['tree_last_string'] = "wiki contributions"; + $data['page_explanation_title'] = "wiki contributions of"; + $data['pageList'] = $this->h['Pages']->render($page-5,11); $this->append($data); - $this->load('wiki'); + $this->load('list_template'); $this->right(); } } - + + //messages in the talk page of the wiki pages + public function wikitalk($lang = 'en', $user = '') + { + $clean['user'] = ctype_alnum($user) ? sanitizeAll($user) : ''; + $data['title'] = "talk messages submitted - ".Website::$generalName; + + $this->shift(2); + + if ($this->m['UsersModel']->userExists($clean['user'])) + { + //load the Pages helper + $this->helper('Pages','meet/wikitalk/'.$this->lang.'/'.$clean['user'],'page'); + + $clean['id_user'] = (int)$this->m['UsersModel']->getUserId($clean['user']); + + $this->m['WikitalkModel']->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->orderBy('id_talk desc'); + + $recordNumber = $this->m['WikitalkModel']->rowNumber(); + $page = $this->viewArgs['page']; + + $this->m['WikitalkModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,20); + + $data['table'] = $this->m['WikitalkModel']->send(); + + $data['meet_username'] = $clean['user']; + + $data['tree_last_string'] = "talk messages (wiki pages)"; + $data['page_explanation_title'] = "talk messages (wiki pages) submitted by"; + + $data['pageList'] = $this->h['Pages']->render($page-3,7); + + $this->append($data); + $this->load('list_template'); + $this->right(); + } + } }
\ No newline at end of file |