Esempio n. 1
0
 /**
  * Get edit assignments for this paper.
  * @return array
  */
 function &getEditAssignments()
 {
     $editAssignments =& $this->getData('editAssignments');
     //return $editAssignments;
     import("helpers.SubmissionHelper");
     return SubmissionHelper::getUniqueEditAssignments($editAssignments);
 }
Esempio n. 2
0
 public function save($object)
 {
     if ($object->name == '') {
         throw new SubmissionTableException('Invalid name');
     }
     if ($object->alias == '' || preg_match('/[^\\x{00C0}-\\x{00D6}x{00D8}-\\x{00F6}x{00F8}-\\x{00FF}x{0370}-\\x{1FFF}a-z0-9\\-]/u', $object->alias)) {
         throw new SubmissionTableException('Invalid slug');
     }
     if (SubmissionHelper::checkAliasExists($object->alias, $object->id)) {
         throw new SubmissionTableException('Slug already exists, please choose a unique slug');
     }
     return parent::save($object);
 }
Esempio n. 3
0
 public function docopy()
 {
     // check for request forgeries
     YRequest::checkToken() or jexit('Invalid Token');
     // init vars
     $cid = YRequest::getArray('cid', array(), 'int');
     if (count($cid) < 1) {
         JError::raiseError(500, JText::_('Select a submission to copy'));
     }
     try {
         // get category table
         $table = YTable::getInstance('submission');
         // copy submissions
         foreach ($cid as $id) {
             // get submission
             $submission = $table->get($id);
             // copy submission
             $submission->id = 0;
             // set id to 0, to force new category
             $submission->name .= ' (' . JText::_('Copy') . ')';
             // set copied name
             $submission->alias = SubmissionHelper::getUniqueAlias($id, $submission->alias . '-copy');
             // set copied alias
             // track parent for ordering update
             $parents[] = $submission->parent;
             // save copied category data
             $table->save($submission);
         }
         // set redirect message
         $msg = JText::_('Submission Copied');
     } catch (YException $e) {
         // raise notice on exception
         JError::raiseNotice(0, JText::_('Error Copying Category') . ' (' . $e . ')');
         $msg = null;
     }
     $this->setRedirect($this->baseurl, $msg);
 }
Esempio n. 4
0
function ZooParseRoute($segments)
{
    // init vars
    $vars = array();
    $count = count($segments);
    // fix segments (see JRouter::_decodeSegments)
    foreach (array_keys($segments) as $key) {
        $segments[$key] = str_replace(':', '-', $segments[$key]);
    }
    // frontpage (with optional pagination)
    $task = 'frontpage';
    if ($count == 1 && $segments[0] == $task) {
        $vars['task'] = $task;
    }
    if ($count == 2 && $segments[0] == $task) {
        $vars['task'] = $task;
        $vars['page'] = (int) $segments[1];
    }
    // category (with optional pagination)
    $task = 'category';
    if ($count == 2 && $segments[0] == $task) {
        $vars['task'] = $task;
        $vars['category_id'] = (int) CategoryHelper::translateAliasToID($segments[1]);
    }
    if ($count == 3 && $segments[0] == $task) {
        $vars['task'] = $task;
        $vars['category_id'] = (int) CategoryHelper::translateAliasToID($segments[1]);
        $vars['page'] = (int) $segments[2];
    }
    // alpha index (with optional pagination)
    $task = 'alphaindex';
    if ($count == 3 && $segments[0] == $task) {
        $vars['task'] = $task;
        $vars['app_id'] = (int) ApplicationHelper::translateAliasToID($segments[1]);
        $vars['alpha_char'] = (string) $segments[2];
    }
    if ($count == 4 && $segments[0] == $task) {
        $vars['task'] = $task;
        $vars['app_id'] = (int) ApplicationHelper::translateAliasToID($segments[1]);
        $vars['alpha_char'] = (string) $segments[2];
        $vars['page'] = (int) $segments[3];
    }
    // tag (with optional pagination)
    $task = 'tag';
    if ($count == 3 && $segments[0] == $task) {
        $vars['task'] = $task;
        $vars['app_id'] = (int) ApplicationHelper::translateAliasToID($segments[1]);
        $vars['tag'] = (string) $segments[2];
    }
    if ($count == 4 && $segments[0] == $task) {
        $vars['task'] = $task;
        $vars['app_id'] = (int) ApplicationHelper::translateAliasToID($segments[1]);
        $vars['tag'] = (string) $segments[2];
        $vars['page'] = (int) $segments[3];
    }
    // item
    $task = 'item';
    if ($count == 2 && $segments[0] == $task) {
        $vars['task'] = $task;
        $vars['item_id'] = (int) ItemHelper::translateAliasToID($segments[1]);
    }
    // feed
    $task = 'feed';
    if ($count == 3 && $segments[0] == $task) {
        $vars['task'] = $task;
        $vars['type'] = (string) $segments[1];
        $vars['app_id'] = (string) $segments[2];
    }
    if ($count == 4 && $segments[0] == $task) {
        $vars['task'] = $task;
        $vars['type'] = (string) $segments[1];
        $vars['app_id'] = (string) $segments[2];
        $vars['category_id'] = (int) CategoryHelper::translateAliasToID($segments[3]);
    }
    // submission
    $task = 'submission';
    $layout = 'submission';
    if ($count == 2 && $segments[0] == $task && $segments[1] == $layout) {
        $vars['task'] = $task;
        $vars['layout'] = (string) $segments[1];
    }
    if ($count == 5 && $segments[0] == $task && $segments[1] == $layout) {
        $vars['task'] = $task;
        $vars['layout'] = (string) $segments[1];
        $vars['submission_id'] = (int) SubmissionHelper::translateAliasToID($segments[2]);
        $vars['type_id'] = (string) $segments[3];
        $vars['submission_hash'] = (string) $segments[4];
    }
    if ($count == 6 && $segments[0] == $task && $segments[1] == $layout) {
        $vars['task'] = $task;
        $vars['layout'] = (string) $segments[1];
        $vars['submission_id'] = (int) SubmissionHelper::translateAliasToID($segments[2]);
        $vars['type_id'] = (string) $segments[3];
        $vars['submission_hash'] = (string) $segments[4];
        $vars['item_id'] = (int) ItemHelper::translateAliasToID($segments[5]);
    }
    // submission mysubmissions
    $task = 'submission';
    $layout = 'mysubmissions';
    if ($count == 2 && $segments[0] == $task && $segments[1] == $layout) {
        $vars['task'] = $task;
        $vars['layout'] = (string) $segments[1];
    }
    if ($count == 3 && $segments[0] == $task && $segments[1] == $layout) {
        $vars['task'] = $task;
        $vars['layout'] = (string) $segments[1];
        $vars['submission_id'] = (int) SubmissionHelper::translateAliasToID($segments[2]);
    }
    return $vars;
}
Esempio n. 5
0
         $title[] = $task;
         $title[] = $query['layout'];
         $title[] = SubmissionHelper::translateIDToAlias((int) $query['submission_id']);
         $title[] = $query['type_id'];
         $title[] = $query['submission_hash'];
         $title[] = ItemHelper::translateIDToAlias((int) @$query['item_id']);
         shRemoveFromGETVarsList('layout');
         shRemoveFromGETVarsList('submission_id');
         shRemoveFromGETVarsList('type_id');
         shRemoveFromGETVarsList('submission_hash');
         shRemoveFromGETVarsList('item_id');
     } else {
         if ($query['layout'] == 'mysubmissions') {
             $title[] = $task;
             $title[] = $query['layout'];
             $title[] = SubmissionHelper::translateIDToAlias((int) $query['submission_id']);
             shRemoveFromGETVarsList('layout');
             shRemoveFromGETVarsList('submission_id');
         }
     }
     break;
 case 'tag':
     $title[] = $task;
     $title[] = ApplicationHelper::translateIDToAlias((int) $query['app_id']);
     $title[] = $query['tag'];
     shRemoveFromGETVarsList('app_id');
     shRemoveFromGETVarsList('tag');
     // pagination
     if (isset($query['page'])) {
         $title[] = $query['page'];
         shRemoveFromGETVarsList('page');
Esempio n. 6
0
	
</div>

<?php 
if (count($this->items)) {
    ?>
<ul class="submissions">

	<?php 
    foreach ($this->items as $id => $item) {
        ?>
	<li>
		
		<div class="header">
			<?php 
        $edit_hash = SubmissionHelper::getSubmissionHash($this->submission->id, $item->type, $id);
        ?>
			<?php 
        $edit_link = RouteHelper::getSubmissionRoute($this->submission, $item->type, $edit_hash, $id, 'mysubmissions');
        ?>
			<?php 
        if ($this->submission->isInTrustedMode()) {
            ?>
				<a href="<?php 
            echo JRoute::_($this->link_base . '&controller=submission&submission_id=' . $this->submission->id . '&task=remove&item_id=' . $id);
            ?>
" title="<?php 
            echo JText::_('Delete Item');
            ?>
" class="item-icon delete-item"></a>
			<?php 
Esempio n. 7
0
 protected function _init()
 {
     //init vars
     $type_id = JRequest::getString('type_id');
     $hash = JRequest::getString('submission_hash');
     $this->redirect = YRequest::getString('redirect');
     // check config
     $this->_checkConfig();
     // get submission info from request
     if ($type_id) {
         if ($hash != SubmissionHelper::getSubmissionHash($this->submission->id, $type_id, $this->item_id)) {
             throw new SubmissionControllerException('Hashes did not match.');
         }
         // else get submission info from active menu
     } elseif ($this->menu_params) {
         $type_id = $this->menu_params->get('type');
         // remove item_id (menu item may not have an item_id)
         $this->item_id = null;
     }
     // set type
     $this->type = $this->submission->getType($type_id);
     // check type
     if (!$this->type) {
         throw new SubmissionControllerException('Submissions are not configured correctly.');
     }
     // set hash
     $this->hash = $hash ? $hash : SubmissionHelper::getSubmissionHash($this->submission->id, $this->type->id, $this->item_id);
     // set layout
     $this->layout = $this->submission->getForm($this->type->id)->get('layout', '');
     // check layout
     if (empty($this->layout)) {
         throw new SubmissionControllerException('Submission is not configured correctly.');
     }
     // set layout path
     $this->layout_path = 'item.';
     if ($this->renderer->pathExists('item/' . $this->type->id)) {
         $this->layout_path .= $this->type->id . '.';
     }
     $this->layout_path .= $this->layout;
     // get positions
     $positions = $this->renderer->getConfig('item')->get($this->application->getGroup() . '.' . $this->type->id . '.' . $this->layout, array());
     // get elements from positions
     $this->elements_config = array();
     foreach ($positions as $position) {
         foreach ($position as $element) {
             if ($element_obj = $this->type->getElement($element->element)) {
                 if (!$this->submission->isInTrustedMode()) {
                     $metadata = $element_obj->getMetaData();
                     if ($metadata['trusted'] == 'true') {
                         continue;
                     }
                 }
                 $this->elements_config[$element->element] = $element;
             }
         }
     }
     // get item table
     $table = YTable::getInstance('item');
     // get item
     if (!$this->item_id || !($this->item = $table->get($this->item_id))) {
         $this->item = new Item();
         $this->item->application_id = $this->application->id;
         $this->item->type = $this->type->id;
         $now = JFactory::getDate();
         $config = JFactory::getConfig();
         $offset = $config->getValue('config.offset');
         $now->setOffset($offset);
         $this->item->publish_up = $now->toFormat(SubmissionController::EDIT_DATE_FORMAT);
         $this->item->publish_down = YDatabase::getInstance()->getNullDate();
     }
 }