예제 #1
0
    public function display()
    {
        // Display the toolbar
        $toolbar = $this->_createToolbar()->reset();
        $this->toolbar = KFactory::get($this->getToolbar(), array('isGrid' => false))->append(KFactory::get('admin::com.ninja.toolbar.button.apply', array('isGrid' => false)));
        KFactory::get('admin::com.ninja.helper.default')->css('/' . $this->getIdentifier()->application . '.' . $this->getName() . '.css');
        KFactory::get('admin::com.ninja.helper.default')->js('/raphael.js');
        KFactory::get('admin::com.ninja.helper.default')->js('/Mapper.js');
        $acl = JFactory::getACL();
        //die('<pre>'.print_r(get_class_methods($acl), true).'</pre>');
        $acltree = (array) $acl->get_group_children_tree(null, 'USERS', false);
        array_unshift($acltree, (object) array('value' => 0, 'text' => 'Unregistered', 'disabled' => false));
        $this->acltree = $acltree;
        $this->usergroups = KFactory::tmp('admin::com.ninjaboard.model.usergroups')->limit(0)->getList();
        $maps = array();
        foreach (KFactory::tmp($this->getModel()->getIdentifier())->limit(0)->getList() as $map) {
            $maps[$map->id] = $map->ninjaboard_gid;
        }
        $this->maps = $maps;
        $display = parent::display();
        if (KRequest::type() == 'AJAX') {
            echo '<script type="text/javascript">
			' . $this->_document->_script['text/javascript'] . '
			</script>';
        }
        return $display;
    }
예제 #2
0
 public function display()
 {
     $params = KFactory::get('admin::com.ninjaboard.model.settings')->getParams();
     $this->assign('params', $params);
     $person = KFactory::get($this->getModel())->getItem();
     if (KFactory::get('lib.joomla.user')->guest && (!$person->id || $this->getlayout() == 'form')) {
         $this->mixin(KFactory::get('admin::com.ninja.view.user.mixin'));
         $this->setLoginLayout();
         return parent::display();
     }
     if ($this->getLayout() != 'form') {
         $controller = KFactory::get('site::com.ninjaboard.controller.topic')->setView(KFactory::get('site::com.ninjaboard.view.topics.html'))->direction('desc')->sort('last_post_on')->limit(KRequest::get('get.limit', 'int', 10))->offset(KRequest::get('get.offset', 'int', 0))->at($this->getModel()->getItem()->id);
         $model = $controller->getModel();
         $state = $model->getState();
         $this->assign('topics', $this->render($controller->layout('list')->display(), JText::_('Latest Topics'), $params['module']));
         $this->assign('pagination', KFactory::get('site::com.ninjaboard.template.helper.paginator', array('name' => 'topics'))->pagination($model->getTotal(), $state->offset, $state->limit, 4, false));
         $me = KFactory::get($this->getModel())->getMe();
         $this->me = $me;
         if ($me->id === $person->id) {
             $this->edit_button = str_replace(array('$title', '$link'), array(JText::_('Edit Profile'), $this->createRoute('view=person&id=' . $person->id . '&layout=form')), $this->params['tmpl']['new_topic_button']);
         } else {
             $this->edit_button = false;
         }
         $this->message_button = $me->id && $this->params['messaging_settings']['enable_messaging'];
         $this->watch_button = $me->id && $this->params['email_notification_settings']['enable_email_notification'];
         $title = sprintf(JText::_("%s's profile"), $person->display_name);
     } else {
         $title = sprintf(JText::_("%s's settings"), $person->display_name);
         $this->save_button = str_replace('$title', JText::_('Save'), $this->params['tmpl']['create_topic_button']);
         $this->save_button = str_replace('$link', '#', $this->save_button);
     }
     $this->_subtitle = $title;
     $this->assign('title', $title);
     return parent::display();
 }
예제 #3
0
 public function display()
 {
     $this->assign('date', KFactory::get('lib.joomla.utilities.date'));
     // Display the toolbar
     $this->_createToolbar()->reset();
     return parent::display();
 }
예제 #4
0
 public function display()
 {
     //Get User details from Joomla!
     $joomla = array('Name' => 'name', 'Username' => 'username', 'E-Mail' => 'email', 'Group' => 'usertype', 'Register Date' => 'registerDate', 'Last Visit Date' => 'lastvisitDate');
     $this->assign('joomla', $joomla);
     $this->assign('ifedit', range(0, 1));
     //Get user
     $usertype = KFactory::get('lib.joomla.user')->get('usertype');
     $this->assign('avatar', null);
     $user = KFactory::get($this->getModel())->getItem();
     $usergroups = array();
     foreach ($user->usergroups as $group) {
         $usergroups[] = $group->id;
     }
     $this->usergroups = $usergroups;
     if ($user->inherits) {
         $this->usergroups = 0;
         $inherits = array();
         foreach ($user->usergroups as $usergroup) {
             $link = '<a href="' . $this->createRoute('view=usergroup&id=' . $usergroup->id) . '">';
             $link .= $usergroup->title;
             $link .= '</a>';
             $inherits[] = $link;
         }
         $this->inherits = implode(', ', $inherits);
     }
     // Display the layout
     return parent::display();
 }
예제 #5
0
 public function display()
 {
     $this->assign('params', KFactory::get('admin::com.ninjaboard.model.settings')->getParams());
     $me = KFactory::get('admin::com.ninjaboard.model.people')->getMe();
     $this->showtopics = false;
     if (isset($this->params['view_settings']['displayed_elements']) && $me->topic_permissions > 0) {
         if (in_array('showtopics', $this->params['view_settings']['displayed_elements'])) {
             $this->showtopics = true;
             //$state		= KFactory::get($this->getModel())->getState();
             /*$this->limit	= KRequest::get('get.limit', 'int', 10);
             		$this->offset	= KRequest::get('get.offset', 'int', 0);
             		$topicsmodel	= KFactory::tmp('site::com.ninjaboard.model.topics')
             							->limit($this->limit)
             							->offset($this->offset)
             							->sort('last_post_date')
             							->direction('desc');
             		$this->total	= $topicsmodel->getTotal();
             		$this->length	= KFactory::tmp('site::com.ninjaboard.model.topics')->getTotal();
             		
             		$this->assign('pagination', 
             			KFactory::get('site::com.ninjaboard.template.helper.paginator', array('name' => 'topics'))
             				->pagination($this->total, $this->offset, $this->limit, 4)
             		);*/
             $this->limit = KRequest::get('get.limit', 'int', 10);
             $this->offset = KRequest::get('get.offset', 'int', 0);
             $this->total = KFactory::get('site::com.ninjaboard.model.topics')->getTotal();
             $this->assign('topics', KFactory::get('site::com.ninjaboard.controller.topic')->setView(KFactory::get('site::com.ninjaboard.view.topics.html'))->direction('desc')->sort('last_post_on')->limit($this->limit)->offset($this->offset)->layout('list')->display());
             $this->assign('pagination', KFactory::get('site::com.ninjaboard.template.helper.paginator', array('name' => 'topics'))->pagination($this->total, $this->offset, $this->limit, 4, false));
         }
     }
     return parent::display();
 }
예제 #6
0
 public function display()
 {
     $topic = $this->getModel()->getItem();
     $this->forum = KFactory::get('site::com.ninjaboard.model.forums')->id($topic->forum_id)->getItem();
     $this->user = KFactory::get('lib.joomla.user');
     $me = KFactory::get('admin::com.ninjaboard.model.people')->getMe();
     $this->watch_button = $me->id && $this->forum->params['email_notification_settings']['enable_email_notification'];
     //Assign forum permissions to topic
     $topic->forum_permissions = $this->forum->forum_permissions;
     $topic->topic_permissions = $this->forum->topic_permissions;
     $topic->post_permissions = $this->forum->post_permissions;
     $topic->attachment_permissions = $this->forum->attachment_permissions;
     if ((!$this->forum->id || !$topic->id || $topic->topic_permissions < 1) && KFactory::tmp('lib.joomla.user')->guest) {
         $this->mixin(KFactory::get('admin::com.ninja.view.user.mixin'));
         $this->setLoginLayout();
         return parent::display();
     } elseif (!$topic->id) {
         JError::raiseError(404, JText::_("Topic not found."));
         return;
     } elseif (!$this->forum->id) {
         JError::raiseError(404, JText::_("Forum not found."));
         return;
     }
     $this->_subtitle = $topic->title;
     //if($topic->id && !KRequest::get('get.layout', 'cmd', false)) $this->setLayout('default');
     $state = $this->getModel()->getState();
     $limit = $state->limit ? $state->limit : 6;
     $offset = KFactory::tmp('site::com.ninjaboard.model.posts')->topic($topic->id)->post($state->post)->limit($limit)->getOffset();
     $offset = KRequest::get('get.offset', 'int', $offset);
     //This is used to set the canonical link correctly in the topic controller after.read
     //@TODO move all this logic out of the view in 1.2
     $this->getModel()->set(array('limit' => $limit, 'offset' => $offset));
     $this->assign('posts', KFactory::tmp('site::com.ninjaboard.controller.post')->setView(KFactory::tmp('site::com.ninjaboard.view.posts.html'))->setModel(KFactory::get('site::com.ninjaboard.model.posts')->setAcl(false))->sort('created_on')->limit($limit)->offset($offset)->post(false)->topic($topic->id)->layout('default')->display());
     if ($this->forum->params['view_settings']['new_topic_button'] == 'topic') {
         $this->new_topic_button = '<div class="new-topic">' . str_replace(array('$title', '$link'), array(JText::_('New Topic'), $this->createRoute('view=post&forum=' . $this->forum->id)), $this->forum->params['tmpl']['new_topic_button']) . '</div>';
     }
     $button = false;
     if (KFactory::get('lib.joomla.user')->guest || $this->forum->post_permissions > 1) {
         $button = str_replace(array('$title', '$link'), array(JText::_('Reply topic'), $this->createRoute('view=post&topic=' . $topic->id)), $this->forum->params['tmpl']['new_topic_button']);
     }
     //$this->reply_topic_button = $this->forum->post_permissions > 1 ? $button : null;
     $this->reply_topic_button = $button;
     $this->lock_topic_button = null;
     $this->move_topic_button = null;
     $this->delete_topic_button = null;
     if ($this->forum->topic_permissions > 2) {
         $this->lock_topic_button = $this->_createActionButton('lock', 'Lock topic', $topic->id, 'lock');
         $this->move_topic_button = str_replace(array('$title', '$link'), array(JText::_('Move topic'), $this->createRoute('view=topic&layout=move&id=' . $topic->id)), $this->forum->params['tmpl']['new_topic_button']);
         $this->delete_topic_button = $this->_createActionButton('delete', 'Delete topic', $topic->id, 'trash');
     }
     $output = parent::display();
     //@TODO move this to the controller
     $hit = KRequest::get('session.' . KFactory::get('admin::com.ninja.helper.default')->formid($topic->id), 'boolean');
     if (!$hit && $topic->created_user_id != $me->id) {
         $topic->hit();
         KRequest::set('session.' . KFactory::get('admin::com.ninja.helper.default')->formid($topic->id), true);
     }
     return $output;
 }
예제 #7
0
 public function display()
 {
     $this->assign('params', KFactory::get('admin::com.ninjaboard.model.settings')->getParams());
     if (KFactory::tmp('lib.joomla.user')->guest) {
         $this->mixin(KFactory::get('admin::com.ninja.view.user.mixin'));
         $this->setLoginLayout();
         return parent::display();
     }
     return parent::display();
 }
예제 #8
0
 public function display()
 {
     $this->usergroup = $this->getModel()->getItem();
     $objects = KFactory::get('admin::com.ninjaboard.permissions')->getObjects();
     foreach ($objects as $object) {
         $names[] = 'com_ninjaboard.usergroup.' . $this->usergroup->id . '.' . $object;
     }
     $this->permissions = KFactory::tmp('admin::com.ninja.helper.access', array('name' => $names, 'id' => KFactory::get('admin::com.ninja.helper.default')->formid('permissions'), 'inputName' => 'permissions', 'inputId' => 'permissions', 'render' => 'usergroups', 'objects' => $objects));
     return parent::display();
 }
예제 #9
0
 /**
  * Method suitable for callbacks that sets the breadcrumbs according to this view context
  *
  * @return void
  */
 public function setBreadcrumbs()
 {
     $pathway = KFactory::get('lib.koowa.application')->getPathWay();
     //Checks the view properties first, in case they're already set
     if (!isset($this->forum)) {
         $this->forum = $this->getModel()->getItem();
     }
     foreach ($this->forum->getParents() as $parent) {
         $pathway->addItem($parent->title, $this->createRoute('view=forum&id=' . $parent->id));
     }
     parent::setBreadcrumbs();
 }
예제 #10
0
 public function display()
 {
     // Display the toolbar
     $toolbar = $this->_createToolbar()->reset();
     $this->toolbar = KFactory::get($this->getToolbar(), array('isGrid' => false))->append(KFactory::get('admin::com.ninja.toolbar.button.apply', array('isGrid' => false)));
     jimport('joomla.filesystem.folder');
     $controllers = JFolder::files(JPATH_COMPONENT_SITE . '/controllers', '.php$');
     foreach ($controllers as $controller) {
         $name = str_replace('.php', '', $controller);
         $this->controllers[$name] = 'site::com.ninjaboard.controller.' . $name;
     }
     return parent::display();
 }
예제 #11
0
 /**
  * Method suitable for callbacks that sets the breadcrumbs according to this view context
  *
  * @return void
  */
 public function setBreadcrumbs()
 {
     parent::setBreadcrumbs();
     $model = $this->getModel();
     $pathway = KFactory::get('lib.koowa.application')->getPathWay();
     $id = $model->getState()->at;
     if (!$id) {
         return;
     }
     $person = KFactory::tmp('admin::com.ninjaboard.model.people')->id($id)->getItem();
     //@TODO consider using the username instead of display_name in this part
     $name = $person->display_name;
     $pathway->addItem('@' . $name, $this->createRoute('view=topics&at=' . $id));
 }
예제 #12
0
 public function display()
 {
     if (!$this->getModel()->getTotal()) {
         return parent::display();
     }
     $this->_createToolbar()->prepend('spacer')->prepend(KFactory::get('admin::com.ninja.toolbar.button.modal', array('text' => 'Map', 'icon' => 'icon-32-map', 'link' => $this->createRoute('view=joomlausergroupmaps&tmpl=component'), 'y' => 470, 'handler' => 'iframe', 'ajaxOptions' => '{evalScripts:true}')));
     $permissions = array();
     $objects = KFactory::get('admin::com.ninjaboard.permissions')->getObjects();
     foreach ($objects as $permission) {
         $permissions[$permission] = KInflector::humanize($permission);
     }
     $this->assign('columns', $permissions);
     $this->assign('colspan', 4 + count($permissions));
     return parent::display();
 }
예제 #13
0
 public function display()
 {
     $params = KFactory::get('admin::com.ninjaboard.model.settings')->getParams();
     $this->assign('params', $params);
     $me = KFactory::get('admin::com.ninjaboard.model.people')->getMe();
     $this->assign('me', $me);
     if (KFactory::get('lib.joomla.user')->guest) {
         $this->mixin(KFactory::get('admin::com.ninja.view.user.mixin'));
         $this->setLoginLayout();
         return parent::display();
     }
     $this->send_button = str_replace('$title', JText::_('Send'), $this->params['tmpl']['create_topic_button']);
     $title = JText::_("Compose");
     $this->_subtitle = $title;
     $this->assign('title', $title);
     return parent::display();
 }
예제 #14
0
 public function display()
 {
     $this->assign('params', KFactory::get('admin::com.ninjaboard.model.settings')->getParams());
     if (KFactory::get('lib.joomla.user')->guest) {
         $this->mixin(KFactory::get('admin::com.ninja.view.user.mixin'));
         $this->setLoginLayout();
         return parent::display();
     }
     $this->person = KFactory::get('admin::com.ninjaboard.model.people')->getMe();
     $title = $this->person->display_name;
     $this->_subtitle = $title;
     $this->assign('title', $title);
     $this->remove_selected_button = str_replace(array('$title', '$link'), array(JText::_('Remove Selected'), '#'), $this->params['tmpl']['create_topic_button']);
     $state = $this->getModel()->getState();
     $this->total = $this->getModel()->getTotal();
     $this->assign('pagination', KFactory::get('site::com.ninjaboard.template.helper.paginator', array('name' => 'watches'))->pagination($this->total, $state->offset, $state->limit, 4));
     return parent::display();
 }
예제 #15
0
 public function display()
 {
     $this->_createToolbar()->reset();
     $this->db = JFactory::getDBO();
     $configs = KFactory::get('lib.joomla.config');
     $this->config = new KConfig();
     foreach (array('host', 'user', 'db', 'dbprefix', 'password') as $config) {
         $this->config->{$config} = $configs->getValue($config);
     }
     $this->menu = KFactory::get('admin::com.ninja.helper.placeholder', array('notice' => 'Select what you want to import.'));
     $this->converters = $this->getModel()->limit(0)->getList();
     foreach ($this->converters as $name => $converter) {
         if (!$converter->button) {
             continue;
         }
         $attribs = array_merge(array('data-name' => $name), $converter->getAttributes());
         $this->menu->append($name, $attribs, $converter->getTitle());
     }
     return parent::display();
 }
예제 #16
0
 public function display()
 {
     $this->assign('params', KFactory::get('admin::com.ninjaboard.model.settings')->getParams());
     $state = $this->getModel()->getState();
     if (!isset($this->total) && !$this->total) {
         $this->total = $this->getModel()->getTotal();
     }
     $this->topic = KFactory::get('site::com.ninjaboard.model.topics')->id($state->topic)->getItem();
     $this->forum = KFactory::get('site::com.ninjaboard.model.forums')->id($this->topic->forum_id)->getItem();
     $this->user = KFactory::get('lib.joomla.user');
     //Assign forum permissions to topic
     $this->topic->forum_permissions = $this->forum->forum_permissions;
     $this->topic->topic_permissions = $this->forum->topic_permissions;
     $this->topic->post_permissions = $this->forum->post_permissions;
     $this->topic->attachment_permissions = $this->forum->attachment_permissions;
     $this->delete_post_button = '<a class="button delete" href="#">' . JText::_('Delete post') . '</a>';
     //Add alias filter for $edit_post_button so it works with 98-template
     $this->getTemplate()->getFilter('alias')->append(array('@edit_post_button' => 'KFactory::get($this->getView())->edit_post_button'));
     $this->assign('pagination', KFactory::get('site::com.ninjaboard.template.helper.paginator', array('name' => 'posts'))->pagination($this->total, $state->offset, $state->limit, 4));
     return parent::display();
 }
예제 #17
0
    public function display()
    {
        //creating the toolbar
        $this->_createToolbar()->append('spacer')->append(KFactory::get('admin::com.ninja.toolbar.button.enable'))->append(KFactory::get('admin::com.ninja.toolbar.button.disable'));
        $this->_document->addScriptDeclaration('
			window.addEvent(\'domready\', function(){
				$$(\'select.auto-redirect\').each(function(e){
					e.addEvent(\'change\', function(){
						var name = this.getProperty(\'name\');
						if ($$(\'div.pagination\')[0].hasClass(\'ajax\')) {
							window.location = \'#\' + name + \'=\' + this.value;
							//window.location = window.location.href.replace(window.location.hash, \'#\' + name + \'=\' + this.value);
						} else {
							var location = this.getProperty(\'rel\');
							window.location = location.replace(\'{value}\', this.value);
							//window.location = this.getProperty(\'rel\').replace(name + \'=0\', name + \'=\' + this.value);
						}
					});
				});
			});
		');
        return parent::display();
    }
예제 #18
0
    public function display()
    {
        jimport('joomla.filesystem.folder');
        jimport('joomla.filesystem.file');
        // path to images directory
        $identifier = KFactory::get($this->getModel())->getIdentifier();
        $path = JPATH_ROOT . DS . 'media' . DS . $identifier->type . '_' . $identifier->package . DS . 'images' . DS . 'forums';
        $filter = '\\.png$|\\.gif$|\\.jpg$|\\.bmp$|\\.ico$';
        $files = JFolder::files($path, $filter, true, true);
        $options = array();
        $options[] = JHTML::_('select.option', null, JText::_('None'));
        $img[] = $this->mediaurl . '/napi/img/blank.gif';
        $optgroup = null;
        if (is_array($files)) {
            foreach ($files as $file) {
                $f = basename(dirname($file));
                $options[] = JHTML::_('select.option', basename($file), basename($file));
                $img[] = $this->mediaurl . '/' . $identifier->type . '_' . $identifier->package . '/images/forums/' . basename($file);
            }
        }
        $document = Kfactory::get('lib.joomla.document');
        $script = 'var ' . $identifier->name . 'Images = new Asset.images(' . json_encode((array) $img) . ', {
		    onComplete: function(){
		    	$(\'icon_preview\').empty(); ' . $identifier->name . 'Images[$(\'icon\').selectedIndex].clone().injectInside(\'icon_preview\');
		    }
		});';
        //$document->addScriptDeclaration($script);
        $this->assign('options', $options);
        $this->assign('attr', array('onchange' => '$(\'icon_preview\').empty(); ' . $identifier->name . 'Images[this.selectedIndex].clone().injectInside(\'icon_preview\')'));
        $forums = array(0 => (object) array('title' => '- No parent -', 'path' => '/'));
        $state = $this->getModel()->getState();
        $this->sort = $state->sort ? $state->sort : 'title';
        $this->direction = $state->direction;
        $list = KFactory::tmp($this->getModel()->getIdentifier())->limit(0)->sort('path_sort_ordering')->enabled('')->getList();
        $id = $this->getModel()->getItem()->id;
        foreach ($list as $forum) {
            if ($forum->id === $id && $id > 0) {
                $forum->disable = true;
            }
            $forum->path .= $forum->id . '/';
            $pos = strpos($forum->path, '/' . $id . '/');
            if ($pos !== false && $pos >= 0 && $id > 0) {
                $forum->disable = true;
            }
            $forum->title = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $forum->level) . $forum->title;
            $forums[] = $forum->getData();
        }
        $this->assign('forums', $forums);
        $filepath = dirname($this->getIdentifier()->filepath) . '/tmpl/params.xml';
        $model = KFactory::get($this->getModel());
        $forum = $model->getItem();
        $this->form = KFactory::tmp('admin::com.ninja.form.parameter', array('data' => $forum->params, 'xml' => $filepath));
        $this->assign('total', $model->getTotal());
        $permissions = array();
        foreach (KFactory::get('admin::com.ninjaboard.model.user_groups')->limit(0)->getList() as $usergroup) {
            $names = array();
            $objects = KFactory::get('admin::com.ninjaboard.permissions')->getObjects();
            foreach ($objects as $object) {
                $names[] = 'com_ninjaboard.forum.' . $forum->id . '.' . $usergroup->id . '.' . $object;
            }
            $permissions[] = array('form' => KFactory::tmp('admin::com.ninja.helper.access', array('name' => $names, 'id' => KFactory::get('admin::com.ninja.helper.default')->formid($forum->id . '-permissions-' . $usergroup->id), 'inputName' => 'permissions[' . $usergroup->id . ']', 'inputId' => 'permissions-' . $usergroup->id, 'render' => 'usergroups', 'objects' => $objects)), 'title' => $usergroup->title, 'group' => $usergroup->id, 'id' => KFactory::get('admin::com.ninja.helper.default')->formid($forum->id . '-permissions-' . $usergroup->id));
        }
        $this->assign('permissions', $permissions);
        return parent::display();
    }
예제 #19
0
 public function display()
 {
     $this->_createToolbar()->reset()->append(KFactory::get('admin::com.ninja.toolbar.button.edit'));
     return parent::display();
 }
예제 #20
0
 public function display()
 {
     $this->assign('params', KFactory::get('admin::com.ninjaboard.model.settings')->getParams());
     $this->assign('me', KFactory::get('admin::com.ninjaboard.model.people')->getMe());
     $this->topicreview = false;
     $post = $this->getModel()->getItem();
     if (!$post->ninjaboard_topic_id) {
         $post->ninjaboard_topic_id = $this->getModel()->getState()->topic;
     }
     $this->topic = $topic = KFactory::get('site::com.ninjaboard.model.topics')->id($post->ninjaboard_topic_id)->getItem();
     if (!$topic->forum_id) {
         $topic->forum_id = KRequest::get('get.forum', 'int');
     }
     $this->forum = $forum = KFactory::get('site::com.ninjaboard.model.forums')->id($topic->forum_id)->getItem();
     $this->topic->attachment_permissions = $this->forum->attachment_permissions;
     $this->topic->attachment_settings = $this->params['attachment_settings']['enable_attachments'];
     if ((!$forum->id || $forum->post_permissions < 2) && KFactory::tmp('lib.joomla.user')->guest) {
         $this->mixin(KFactory::get('admin::com.ninja.view.user.mixin'));
         $this->setLoginLayout();
         return parent::display();
     } elseif (!$forum->id || $forum->post_permissions < 2) {
         JError::raiseNotice(401, JText::_("You don't have the permissions to post in this forum."));
         return;
     }
     if (!empty($post->id)) {
         $title = $post->subject ? $post->subject : $topic->title;
         $this->_subtitle = $title;
         $this->title = sprintf(JText::_('Editing post «%s»'), $title);
         if ($this->me->id == $post->created_by) {
             $this->notify = (bool) KFactory::tmp('admin::com.ninjaboard.model.watches')->by($this->me->id)->type_name('topic')->type_id($topic->id)->getTotal();
         } else {
             $this->notify = -1;
         }
     } else {
         if ($topic->id) {
             $this->_subtitle = $topic->title;
             $this->title = sprintf(JText::_('Post Reply to %s in %s'), "'" . $topic->title . "'", $forum->title);
             $this->notify = $this->me->notify_on_reply_topic;
             $model = KFactory::tmp('site::com.ninjaboard.model.posts')->sort('created_on')->direction('desc')->limit(5)->offset(0)->post(false)->topic($topic->id);
             $view = KFactory::tmp('site::com.ninjaboard.view.posts.html', array('model' => $model));
             $total = count($model->getList());
             $this->topicreview = $total > 0 ? $view->assign('total', $total) : false;
             /*
             			//@TODO figure out why action.browse is executed before this one, as that's why we have the setView workaround
             			$controller = KFactory::tmp('site::com.ninjaboard.controller.post')
             				->sort('created_on')
             				->direction('desc')
             				->limit(5)
             				->offset(0)
             				->post(false)
             				->topic($topic->id)
             				->setModel(KFactory::tmp('site::com.ninjaboard.model.posts'));
             			$this->topicreview = $controller
             			
             				//@TODO Figure out why the singular view is used instead of the plural one
             				//@NOTE A fresh model is passed to the view as com.ninjaboard.controller.post have already 
             				//      executed browse at this point. Remember to investigate why that is
             				->setView(KFactory::tmp('site::com.ninjaboard.view.posts.html', array('model' => $controller->getModel()->set($controller->getRequest()))))
             			
             				->layout('default')
             				->display();
             			 //*/
         } else {
             $this->title = $this->_subtitle = sprintf(JText::_('Create New Topic in %s'), $forum->title);
             $this->notify = $this->me->notify_on_create_topic;
         }
     }
     if ($post->id) {
         $this->create_topic_button_title = JText::_('Save');
     } else {
         $this->create_topic_button_title = JText::_('Submit');
     }
     $this->create_topic_button = str_replace(array('$title', '$link'), array($this->create_topic_button_title, '#'), $this->params['tmpl']['create_topic_button']);
     $this->preview_button = str_replace(array('$title', '$link'), array(JText::_('Preview'), '#'), $this->params['tmpl']['create_topic_button']);
     //if($topic->id && !KRequest::get('get.layout', 'cmd', false)) $this->setLayout('default');
     $this->post = KFactory::get('site::com.ninjaboard.model.posts')->id(KRequest::get('get.post', 'int'))->getItem();
     $this->assign('attachments', $post->id ? KFactory::tmp('site::com.ninjaboard.model.attachments')->post($post->id)->getList() : array());
     return parent::display();
 }
예제 #21
0
 public function display()
 {
     // Display the toolbar
     $this->_createToolbar()->append('spacer')->append(KFactory::get('admin::com.ninja.toolbar.button.default'));
     return parent::display();
 }