Пример #1
0
 /**
  * Change license status
  * Redirects to license listing
  *
  * @return  void
  */
 public function changestatusTask()
 {
     // Check for request forgeries
     Request::checkToken();
     // Incoming
     $ids = Request::getVar('id', array(0), '', 'array');
     // Initialize
     $row = new \Components\Publications\Tables\License($this->database);
     foreach ($ids as $id) {
         $id = intval($id);
         if (!$id) {
             continue;
         }
         // Load row
         $row->loadLicense($id);
         $row->active = $row->active == 1 ? 0 : 1;
         // Save
         if (!$row->store()) {
             App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), $row->getError(), 'error');
             return;
         }
     }
     // Redirect
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_PUBLICATIONS_SUCCESS_LICENSE_PUBLISHED'));
 }
Пример #2
0
if ($this->project->isProvisioned()) {
    ?>
				<input type="hidden" name="task" value="submit" />
				<input type="hidden" name="ajax" value="0" />
			<?php 
}
?>
		</fieldset>

		<?php 
if ($this->block == 'license') {
    $task = 'apply';
    // Get selections
    $selections = NULL;
    $selected = NULL;
    $objL = new \Components\Publications\Tables\License($this->database);
    $selected = $objL->getPubLicense($this->publication->get('version_id'));
    $selections = $objL->getBlockLicenses($manifest, $selected);
    if (!$selections) {
        $selections = $objL->getDefaultLicense();
    }
    if (!$selections) {
        echo '<p class="error">' . Lang::txt('PLG_PROJECTS_PUBLICATIONS_SELECTOR_ERROR_NO_SELECTIONS') . '</p>';
    } else {
        ?>
				<p class="requirement" id="req"><?php 
        echo Lang::txt('PLG_PROJECTS_PUBLICATIONS_SELECTOR_REQ_' . strtoupper($this->block));
        ?>
</p>
				<div id="content-selector" class="content-selector">
					<?php 
Пример #3
0
 /**
  * Check completion status
  *
  * @return  object
  */
 public function getStatus($pub = NULL, $manifest = NULL, $elementId = NULL)
 {
     // Start status
     $status = new \Components\Publications\Models\Status();
     $status->status = 1;
     // Load license class
     $objL = new \Components\Publications\Tables\License($this->_parent->_db);
     if ($pub->license_type && $objL->load($pub->license_type)) {
         $agreement = $pub->params->get('licenseagreement');
         // Missing agreement?
         if ($objL->agreement == 1 && !$agreement) {
             $status->setError(Lang::txt('PLG_PROJECTS_PUBLICATIONS_LICENSE_NEED_AGREEMENT'));
             $status->status = 0;
         }
         if ($objL->customizable == 1 && $objL->text && !$pub->license_text) {
             $status->setError(Lang::txt('PLG_PROJECTS_PUBLICATIONS_LICENSE_NEED_TEXT'));
             $status->status = 0;
         }
         if ($pub->license_text) {
             preg_replace('/\\[([^]]+)\\]/', ' ', $pub->license_text, -1, $bingo);
             if ($bingo) {
                 $status->setError(Lang::txt('Default values need to be substituted'));
                 $status->status = 0;
             }
         }
     } else {
         $status->status = 0;
     }
     return $status;
 }