Пример #1
0
 /**
  * Build panel content
  *
  * @return  string  HTML
  */
 public function buildContent($pub = NULL, $viewname = 'edit')
 {
     $name = $viewname == 'freeze' || $viewname == 'curator' ? 'freeze' : 'draft';
     // Get selector styles
     \Hubzero\Document\Assets::addPluginStylesheet('projects', 'team', 'selector');
     // Output HTML
     $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'publications', 'name' => $name, 'layout' => 'authors'));
     // Get authors
     if (!isset($pub->_authors)) {
         $pAuthors = new \Components\Publications\Tables\Author($this->_parent->_db);
         $pub->_authors = $pAuthors->getAuthors($pub->version_id);
         $pub->_submitter = $pAuthors->getSubmitter($pub->version_id, $pub->created_by);
     }
     // Get creator groups
     $view->groups = \Hubzero\User\Helper::getGroups($pub->_project->get('owned_by_user'), 'members', 1);
     $view->pub = $pub;
     $view->manifest = $this->_manifest;
     $view->step = $this->_blockId;
     // Get team members
     $objO = new \Components\Projects\Tables\Owner($this->_parent->_db);
     $view->teamids = $objO->getIds($pub->_project->get('id'), 'all', 0, 0);
     if ($this->getError()) {
         $view->setError($this->getError());
     }
     return $view->loadTemplate();
 }
Пример #2
0
 /**
  * Get project owner
  *
  * @return     mixed
  */
 public function owner()
 {
     if (!$this->exists()) {
         return array();
     }
     if (!isset($this->_owner)) {
         $objO = new \Components\Projects\Tables\Owner($this->_db);
         $this->_owner = $objO->isOwner(User::get('id'), $this->publication->project_id);
     }
     return $this->_owner;
 }
Пример #3
0
			</tr>
		</thead>
		<tbody>
<?php 
foreach ($this->team as $owner) {
    // Get profile thumb image
    $profile = \Hubzero\User\Profile::getInstance($owner->userid);
    $actor = \Hubzero\User\Profile::getInstance($this->uid);
    $thumb = $profile ? $profile->getPicture() : $actor->getPicture(true);
    $timecheck = date('Y-m-d H:i:s', time() - 15 * 60);
    $lastvisit = $owner->lastvisit && $owner->lastvisit != '0000-00-00 00:00:00' ? \Components\Projects\Helpers\Html::timeAgo($owner->lastvisit) . ' ' . Lang::txt('PLG_PROJECTS_TEAM_AGO') : Lang::txt('PLG_PROJECTS_TEAM_NEVER');
    $lastvisit = $owner->userid == $this->uid || $owner->online && $owner->lastvisit > $timecheck ? '<span class="online">' . Lang::txt('PLG_PROJECTS_TEAM_ONLINE_NOW') . '</span>' : $lastvisit;
    // User deleted?
    // Edge case!
    if ($owner->userid && !$owner->username) {
        $objO = new \Components\Projects\Tables\Owner($this->database);
        $objO->load($owner->id);
        $objO->status = 2;
        $objO->store();
        continue;
    }
    $creator = $this->model->owner('id') == $owner->userid ? 1 : 0;
    // Determine css class for user
    switch ($owner->role) {
        case '1':
            $role = Lang::txt('PLG_PROJECTS_TEAM_LABEL_OWNER');
            break;
        case '2':
        default:
            $role = Lang::txt('PLG_PROJECTS_TEAM_LABEL_COLLABORATOR');
            break;
Пример #4
0
 /**
  * Save publication submitter
  *
  * @param      integer $vid 				Pub version ID
  * @param      integer $by					Publication creator
  * @return     mixed False if error, Object on success
  */
 public function saveSubmitter($vid = NULL, $by = 0, $projectid = 0)
 {
     if (!$vid) {
         $vid = $this->publication_version_id;
     }
     if (!$vid || !$by) {
         return false;
     }
     // Get name/org
     $author = $this->getAuthorByUid($vid, $by);
     if (!$author) {
         return false;
     }
     require_once PATH_CORE . DS . 'components' . DS . 'com_projects' . DS . 'tables' . DS . 'owner.php';
     // Get project owner info
     $objO = new \Components\Projects\Tables\Owner($this->_db);
     $owner_id = $objO->getOwnerId($projectid, $by);
     // Load submitter record if exists
     $query = "SELECT * FROM {$this->_tbl} WHERE role='submitter' AND publication_version_id=" . $this->_db->quote($vid);
     $this->_db->setQuery($query);
     if ($result = $this->_db->loadAssoc()) {
         $this->bind($result);
         $this->modified = Date::toSql();
         $this->modified_by = User::get('id');
     } else {
         $this->publication_version_id = $vid;
         $this->role = 'submitter';
         $this->created = Date::toSql();
         $this->created_by = User::get('id');
         $this->ordering = 1;
     }
     $this->project_owner_id = $owner_id;
     $this->user_id = $by;
     $this->status = 1;
     $this->name = $author->name ? $author->name : $author->p_name;
     $this->organization = $author->organization ? $author->organization : $author->p_organization;
     $this->firstName = $author->firstName ? $author->firstName : NULL;
     $this->lastName = $author->lastName ? $author->lastName : NULL;
     $this->credit = 'Submitter';
     $this->store();
 }
Пример #5
0
 /**
  * Edit author name and details
  *
  * @return  void
  */
 public function editauthorTask()
 {
     // Incoming
     $author = Request::getInt('author', 0);
     $this->view->setLayout('editauthor');
     $this->view->author = new Tables\Author($this->database);
     if ($this->_task == 'editauthor' && !$this->view->author->load($author)) {
         throw new Exception(Lang::txt('COM_PUBLICATIONS_ERROR_NO_AUTHOR_RECORD'), 404);
         return;
     }
     // Version ID
     $vid = Request::getInt('vid', $this->view->author->publication_version_id);
     $this->view->row = new Tables\Version($this->database);
     $this->view->pub = new Tables\Publication($this->database);
     // Load version
     if (!$this->view->row->load($vid)) {
         throw new Exception(Lang::txt('COM_PUBLICATIONS_NOT_FOUND'), 404);
         return;
     }
     // Load publication
     $pid = Request::getInt('pid', $this->view->row->publication_id);
     if (!$this->view->pub->load($pid)) {
         throw new Exception(Lang::txt('COM_PUBLICATIONS_NOT_FOUND'), 404);
         return;
     }
     // Instantiate project owner
     $objO = new \Components\Projects\Tables\Owner($this->database);
     $filters = array();
     $filters['limit'] = 0;
     $filters['start'] = 0;
     $filters['sortby'] = 'name';
     $filters['sortdir'] = 'ASC';
     $filters['status'] = 'active';
     // Get all active team members
     $this->view->team = $objO->getOwners($this->view->pub->project_id, $filters);
     // Set any errors
     if ($this->getError()) {
         foreach ($this->getErrors() as $error) {
             $this->view->setError($error);
         }
     }
     // Output the HTML
     $this->view->display();
 }