コード例 #1
0
 /**
  * Browser within publications NEW
  *
  * @return     string
  */
 public function select()
 {
     // Incoming
     $props = Request::getVar('p', '');
     $ajax = Request::getInt('ajax', 0);
     $pid = Request::getInt('pid', 0);
     $vid = Request::getInt('vid', 0);
     $filter = urldecode(Request::getVar('filter', ''));
     // Parse props for curation
     $parts = explode('-', $props);
     $block = isset($parts[0]) ? $parts[0] : 'content';
     $step = isset($parts[1]) && is_numeric($parts[1]) && $parts[1] > 0 ? $parts[1] : 1;
     $element = isset($parts[2]) && is_numeric($parts[2]) && $parts[2] > 0 ? $parts[2] : 1;
     // Provisioned project?
     $prov = $this->model->isProvisioned() ? 1 : 0;
     // Output HTML
     $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'databases', 'name' => 'selector', 'layout' => 'default'));
     $view->publication = new \Components\Publications\Models\Publication($pid, NULL, $vid);
     // On error
     if (!$view->publication->exists()) {
         // Output error
         $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'files', 'name' => 'error'));
         $view->title = '';
         $view->option = $this->_option;
         $view->setError(Lang::txt('PLG_PROJECTS_DATABASES_SELECTOR_ERROR_NO_PUBID'));
         return $view->loadTemplate();
     }
     $view->publication->attachments();
     // Get curation model
     $view->publication->setCuration();
     // Make sure block exists, else use default
     $view->publication->_curationModel->setBlock($block, $step);
     // Set pub assoc and load curation
     $view->publication->_curationModel->setPubAssoc($view->publication);
     \Hubzero\Document\Assets::addPluginStylesheet('projects', 'databases', 'selector');
     if (!$ajax) {
         \Hubzero\Document\Assets::addPluginStylesheet('projects', 'publications', 'selector');
     }
     $view->option = $this->_option;
     $view->database = $this->_database;
     $view->model = $this->model;
     $view->uid = $this->_uid;
     $view->ajax = $ajax;
     $view->element = $element;
     $view->block = $block;
     $view->step = $step;
     $view->props = $props;
     $view->filter = $filter;
     // Get databases to choose from
     $objPD = new \Components\Projects\Tables\Database($this->_database);
     $view->items = $objPD->getItems($this->model->get('id'), array());
     // Get messages	and errors
     if ($this->getError()) {
         $view->setError($this->getError());
     }
     $arr = array('html' => $view->loadTemplate(), 'metadata' => '', 'msg' => '', 'referer' => '');
     return $arr;
 }
コード例 #2
0
ファイル: default.php プロジェクト: mined-gatech/hubzero-cms
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 */
// No direct access
defined('_HZEXEC_') or die;
// Get databases to choose from
$objPD = new \Components\Projects\Tables\Database($this->database);
$items = $objPD->getItems($this->model->get('id'), array());
$missing = array();
$shown = array();
// Attached item
$selected = NULL;
if ($this->primary && !empty($this->attachments)) {
    $selected = $this->attachments[0]->object_name;
}
// Build url
$route = $this->model->isProvisioned() ? 'index.php?option=com_publications' . '&task=submit' : 'index.php?option=com_projects' . '&alias=' . $this->model->get('alias');
$p_url = Route::url($route . '&active=databases');
?>
<ul id="c-browser" <?php 
if (count($items) == 0 && isset($this->attachments) && count($this->attachments) == 0) {
    echo 'class="hidden"';
}