function index() { $project = $this->loadModel('JhProject'); $versions = $this->loadModel('JhProjectVersion'); //TODO ADD PAGINATION!!! $projects = $project->fetchAll("published = '1'", "name asc"); $ids = array(); $projectset = array(); foreach ($projects as $project) { $ids[] = $project->id; $projectset[$project->id] = $project; } $versionArray = $versions->fetchAll("project_id in (" . implode(",", $ids) . ") and published = '1' group by project_id", "release_date desc, id desc "); $data = array(); foreach ($versionArray as $version) { $data['projects'][$version->id] = array('id' => $version->project_id, 'name' => $projectset[$version->project_id]->name, 'newsletter_link' => $projectset[$version->project_id]->newsletter_link, 'forum_link' => $projectset[$version->project_id]->forum_link, 'versionName' => $version->release_name, 'versionNumber' => $version->release_version, 'versionDate' => $version->release_date, 'download_link' => $version->download_link); } JhProjectViewProjects::display('projectlist', $data); }
function editRevision() { $data = array(); $wiki = $this->loadModel('JhProjectWikiEntries'); $revs = $this->loadModel('JhProjectWikiEntryRevisions'); $id = JRequest::getVar('id'); $revs->load($id); $data['page'] = $revs->title; $project = $revs->project_id; $data['project'] = $project; $user =& JFactory::getUser(); $data['user'] = $user; $wiki->findByTitle($revs->title, $project); $wiki->content = stripslashes($revs->content); $data['entry'] = $wiki; $username = false; if ($wiki->user_id > 0) { $db =& $wiki->getDBO(); $db->setQuery("Select username from #__users where id = {$wiki->user_id}"); $username = $db->loadResult(); } $data['username'] = $username; $data['entry']->title = $revs->title; JhProjectViewProjects::display('wikieditentry', $data); }
function changelog() { //print_r($_REQUEST); JRequest::setVar('tmpl', 'component'); $project_id = JRequest::getVar('pid'); $version_id = JRequest::getVar('vid'); $project = $this->loadModel('JhProject'); $version = $this->loadModel('JhProjectVersion'); $project->load($project_id); $version->load($version_id); $data = array('project' => $project, 'version' => $version); JhProjectViewProjects::display('changelog', $data); //echo 'Changelog to go here'; }
function editbug() { $project_id = (int) JRequest::getVar('pid', 0); $bug_id = (int) JRequest::getVar('bid', 0); $user =& JFactory::getUser(); //also now need to make sure is a Joomla admin/special user for this version!!! $gid = $user->get('aid', 0); if ($user->id < 1 || $gid < 2) { $mainframe =& JFactory::getApplication(); $mainframe->redirect(JRoute::_('index.php?option=com_jhproject&view=bugs&pid=' . $project_id), JText::_('Insufficient premissions to edit a bug / feature request')); } $data = array(); $bugs = $this->loadModel('JhProjectBugtrack'); $bugs->load($bug_id); $data['bug'] = $bugs; $fields = $this->loadModel('JhProjectBugtrackOptions'); $project = $this->loadModel('JhProject'); $project->load($project_id); $data['project'] = $project; $versions = $this->loadModel('JhProjectVersion'); $vlist = $versions->fetchAll("published = 1 and project_id = {$project_id}"); $data['options'] = $fields->getLists($project_id); //print_r($vlist); $data['versions'] = array(); if (is_array($vlist)) { foreach ($vlist as $ver) { $data['versions'][$ver->id] = $ver->release_version; } } //need a users list:: $usertable = $user->getTable(); $usertbl = $usertable->getTableName(); //echo $usertbl; $db =& $usertable->getDBO(); $db->setQuery("select `id`,`username` from `{$usertbl}` where block = '0' order by `username` asc"); $result = $db->loadAssocList(); $users = array(); foreach ($result as $res) { $users[$res['id']] = $res['username']; } $data['users'] = $users; // print_r($usertable); // echo '<pre>'; // print_r($data); // echo '</pre>'; //die(); //Need options etc to generate the form JhProjectViewProjects::display('bugformedit', $data); }