Exemplo n.º 1
0
 /**
  * Suggest Records based on public tags value
  * @return array suggested_records
  */
 function suggest()
 {
     $ci =& get_instance();
     $ci->db->select('tag')->from('registry_object_tags')->where('key', $this->ro->key);
     $query = $ci->db->get();
     $str = '';
     $suggestions = array();
     //construct the query stirng
     if ($query->result_array()) {
         foreach ($query->result_array() as $row) {
             $str .= 'tag_search:(' . $row['tag'] . ') ';
         }
     }
     //return(array($str));
     //call SOLR library
     if ($str != '') {
         $maxRows = 50;
         $ci->load->library('solr');
         $ci->solr->init();
         $ci->solr->init()->setOpt('q', $str)->setOpt('rows', $maxRows)->setOpt('fl', 'id,key,slug,title,score')->setOpt('fq', '-id:' . $this->ro->id)->setOpt('fq', 'class:collection')->setOpt('defType', 'edismax');
         $result = $ci->solr->executeSearch(true);
         if ($result['response']['numFound'] > 0) {
             $maxScore = floatval($result['response']['maxScore']);
             $intScore = 0;
             foreach ($result['response']['docs'] as $doc) {
                 $doc['score'] = $doc['score'] / $maxScore * (1 - $intScore / $maxRows);
                 $intScore++;
                 $doc['RDAUrl'] = portal_url($doc['slug'] . '/' . $doc['id']);
                 $suggestions[] = $doc;
             }
         }
     }
     return $suggestions;
 }
Exemplo n.º 2
0
 public function add_user_data($type)
 {
     header('Cache-Control: no-cache, must-revalidate');
     header('Content-type: application/json');
     set_exception_handler('json_exception_handler');
     $data = json_decode(file_get_contents("php://input"), true);
     $data = $data['data'];
     $this->load->model('portal_user');
     $message = array('status' => 'OK');
     //prepare the data to be saved
     if ($type == 'saved_search') {
         $data = array('query_string' => $data);
         $saved_data = array('type' => $type, 'value' => $data);
         $message['saved_data'] = $saved_data;
         $this->portal_user->add_user_data($saved_data);
     }
     if ($type == 'saved_record') {
         foreach ($data as $d) {
             if (!$this->portal_user->has_saved_record($d['id'], $d['folder'])) {
                 $saved_data = array('type' => $type, 'value' => array('folder' => $d['folder'], 'id' => $d['id'], 'slug' => $d['slug'], 'class' => $d['class'], 'type' => $d['type'], 'url' => portal_url($d['slug'] . '/' . $d['id']), 'title' => $d['title'], 'saved_time' => $d['saved_time']));
                 $this->portal_user->add_user_data($saved_data);
             } else {
                 $message['status'] = 'error';
                 $message['info'] = 'record with ' . $d['title'] . ' already bookmarked';
             }
         }
     }
     echo json_encode($message);
 }
 private function lookup($query)
 {
     $query = urldecode($query);
     $r = array();
     $this->load->model('registry/registry_object/registry_objects', 'ro');
     $ro = $this->ro->getByID($query);
     if (!$ro) {
         $ro = $this->ro->getBySlug($query);
     }
     if (!$ro) {
         $ro = $this->ro->getPublishedByKey($query);
     }
     if ($ro) {
         $r['status'] = 0;
         $r['result'] = array('id' => $ro->id, 'rda_link' => portal_url($ro->slug), 'key' => $ro->key, 'slug' => $ro->slug, 'title' => $ro->title, 'class' => $ro->class, 'type' => $ro->type, 'group' => $ro->group);
         if ($ro->getMetadata('the_description')) {
             $r['result']['description'] = $ro->getMetadata('the_description');
         } else {
             $r['result']['description'] = '';
         }
     } else {
         $r['status'] = 1;
         $r['message'] = 'No Registry Object Found';
     }
     return $r;
 }
 /**
  * Suggest Records based on the title or description
  * containing similar text, using the Solr's mlt search.
  * Rely on Solr's score.
  * @return array suggested_records
  */
 function suggest()
 {
     //construct the query string
     $str = 'id:' . $this->ro->id;
     $maxRows = 50;
     //call SOLR library
     $ci =& get_instance();
     $ci->load->library('solr');
     $ci->solr->init();
     $ci->solr->init()->setOpt('q', $str)->setOpt('rows', '1')->setOpt('fl', 'id,key,slug,title,score,class')->setOpt('defType', 'edismax')->setOpt('fq', 'class:collection')->setOpt('mlt', 'true')->setOpt('mlt.fl', 'description_value,title_search')->setOpt('mlt.count', $maxRows);
     $suggestions = array();
     $result = $ci->solr->executeSearch(true);
     if (isset($result['moreLikeThis'][$this->ro->id]) && $result['moreLikeThis'][$this->ro->id]['numFound'] > 0) {
         $maxScore = false;
         $intScore = 0;
         foreach ($result['moreLikeThis'][$this->ro->id]['docs'] as $doc) {
             if ($doc['class'] == 'collection') {
                 if (!$maxScore) {
                     $maxScore = floatval($doc['score']);
                 }
                 $doc['score'] = $doc['score'] / $maxScore * (1 - $intScore / $maxRows);
                 $intScore++;
                 $doc['RDAUrl'] = portal_url($doc['slug'] . '/' . $doc['id']);
                 $suggestions[] = $doc;
             }
         }
     }
     return $suggestions;
 }
Exemplo n.º 5
0
 private function getSuggestionsBySolrQuery($search_query, $start, $rows)
 {
     $CI =& get_instance();
     $start = $start ? $start : 0;
     $rows = $rows ? $rows : 10;
     $CI->load->library('solr');
     $CI->solr->init();
     $CI->solr->setOpt("q", $search_query);
     $CI->solr->setOpt("start", $start);
     $CI->solr->setOpt("rows", $rows);
     $result = $CI->solr->executeSearch(true);
     $suggestions = array();
     //var_dump($result);
     if (isset($result['response']['numFound']) && $result['response']['numFound'] > 0) {
         $links = array();
         foreach ($result['response']['docs'] as $doc) {
             $links[] = array("url" => portal_url($doc['slug']), "title" => $doc['display_title'], "class" => $doc['class'], "description" => isset($doc['description']) ? $doc['description'] : '', "slug" => $doc['slug']);
         }
         if (!$rows) {
             $rows = 10;
         }
         $pagination = array();
         if ($start == 0) {
             $currentPage = 1;
         } else {
             $currentPage = ceil($start / $rows) + 1;
         }
         $totalPage = ceil($result['response']['numFound'] / (int) $rows);
         if ($currentPage != 1) {
             $prev = $start - $rows;
             $next = $start + $rows;
         } else {
             if ($currentPage == 1 && $totalPage == 1) {
                 $prev = false;
                 $next = false;
             } elseif ($currentPage == $totalPage) {
                 $prev = $start - $rows;
                 $next = false;
             } else {
                 $prev = false;
                 $next = $start + $rows;
             }
         }
         $pagination = array("currentPage" => $currentPage, "totalPage" => $totalPage);
         if ($prev !== false) {
             $pagination['prev'] = (string) $prev;
         }
         if ($next !== false) {
             $pagination['next'] = (string) $next;
         }
         if ($start == 10) {
             $pagination['prev'] = '0';
         }
         $suggestions = array("count" => $result['response']['numFound'], "links" => $links, "pagination" => $pagination, "suggestor" => 'ands_subjects');
     }
     return $suggestions;
 }
Exemplo n.º 6
0
 public function post_authentication_hook()
 {
     $redirect = $this->input->get('redirect') ? $this->input->get('redirect') : 'auth/dashboard';
     $this->load->helper('cookie');
     if (get_cookie('auth_redirect')) {
         $redirect = get_cookie('auth_redirect');
         delete_cookie('auth_redirect');
     }
     if ($redirect == 'profile' || $redirect == portal_url('profile')) {
         $redirect = portal_url('profile') . '#!/dashboard';
     }
     $this->redirect_hook($redirect);
 }
 private function getSuggestionsBySolrQuery($search_query)
 {
     $CI =& get_instance();
     $CI->load->library('solr');
     $CI->solr->init();
     $CI->solr->setOpt("q", $search_query);
     $result = $CI->solr->executeSearch(true);
     $suggestions = array();
     if (isset($result['response']['numFound']) && $result['response']['numFound'] > 0) {
         $links = array();
         foreach ($result['response']['docs'] as $doc) {
             $links[] = array("url" => portal_url($doc['slug']), "title" => $doc['display_title'], "group" => $doc['group'], "slug" => $doc['slug']);
         }
         $suggestions = array("count" => $result['response']['numFound'], "links" => $links, "suggestor" => 'ands_duplicates');
     } else {
         $suggestions = array("search_query" => $search_query);
     }
     return $suggestions;
 }
 /**
  * Suggest Records based on subject_value_unresolved value
  * from the local SOLR core.
  * Rely on Solr's score.
  * @return array suggested_records
  */
 function suggest()
 {
     //Get subjects from the XML
     $suggestions = array();
     $sxml = $this->ro->getSimpleXML();
     if ($sxml->registryObject) {
         $sxml = $sxml->registryObject;
     }
     // Subject matches
     $my_subjects = array();
     if ($sxml->{strtolower($this->ro->class)}->subject) {
         foreach ($sxml->{strtolower($this->ro->class)}->subject as $subject) {
             $my_subjects[] = (string) removeBadValue($subject);
         }
     }
     //construct the query stirng
     $str = '';
     foreach ($my_subjects as $s) {
         $str .= 'subject_value_unresolved:(' . $s . ') ';
     }
     if ($str != '') {
         //call SOLR library
         $maxRows = 50;
         $ci =& get_instance();
         $ci->load->library('solr');
         $ci->solr->init();
         $ci->solr->init()->setOpt('q', $str)->setOpt('rows', $maxRows)->setOpt('fl', 'id,key,slug,title,score')->setOpt('fq', '-id:' . $this->ro->id)->setOpt('fq', 'class:collection')->setOpt('defType', 'edismax');
         $result = $ci->solr->executeSearch(true);
         if ($result['response']['numFound'] > 0) {
             $maxScore = floatval($result['response']['maxScore']);
             $intScore = 0;
             foreach ($result['response']['docs'] as $doc) {
                 $doc['score'] = $doc['score'] / $maxScore * (1 - $intScore / $maxRows);
                 $intScore++;
                 $doc['RDAUrl'] = portal_url($doc['slug'] . '/' . $doc['id']);
                 $suggestions[] = $doc;
             }
         }
     }
     return $suggestions;
 }
 /**
  * Suggest Records based on related object ids, using the Solr's mlt search.
  * Rely on Solr's score.
  * @return array suggested_records
  */
 function suggest()
 {
     //construct the query string
     $ci =& get_instance();
     $ci->load->library('solr');
     $ci->solr->init();
     $str = 'id:' . $this->ro->id;
     $centers = array();
     $suggestions = array();
     $ci->solr->init()->setOpt('q', $str)->setOpt('rows', '50')->setOpt('fl', 'spatial_coverage_centres');
     $result = $ci->solr->executeSearch(true);
     if ($result['response']['numFound'] > 0) {
         foreach ($result['response']['docs'] as $doc) {
             if (isset($doc['spatial_coverage_centres'])) {
                 $centers[] = $doc['spatial_coverage_centres'];
             }
         }
     }
     foreach ($centers as $key => $center) {
         $maxRows = 50;
         $latLon = explode(' ', $center[0]);
         if (!is_array($latLon) || count($latLon) < 2) {
             $latLon = explode(',', $center[0]);
         }
         if (is_array($latLon) && count($latLon == 2)) {
             $ci->solr->init()->setOpt('q', '*:*')->setOpt('rows', $maxRows)->setOpt('fq', '-id:' . $this->ro->id)->setOpt('fq', 'class:collection')->setOpt('fq', '{!geofilt pt=' . $latLon[1] . ',' . $latLon[0] . ' sfield=spatial_coverage_extents d=50}')->setOpt('fl', 'id,key,slug,title,score');
             $result = $ci->solr->executeSearch(true);
             if ($result['response']['numFound'] > 0) {
                 $maxScore = floatval($result['response']['maxScore']);
                 $intScore = 0;
                 foreach ($result['response']['docs'] as $doc) {
                     $doc['score'] = $doc['score'] / $maxScore * (1 - $intScore / $maxRows);
                     $intScore++;
                     $doc['RDAUrl'] = portal_url($doc['slug'] . '/' . $doc['id']);
                     $suggestions[] = $doc;
                 }
             }
         }
     }
     return $suggestions;
 }
Exemplo n.º 10
0
 public function index()
 {
     $cat_1 = config('homepage_category_1');
     $cat_2 = config('homepage_category_2');
     $cat_3 = config('homepage_category_3');
     $cat_4 = config('homepage_category_4');
     $homepage_category_1_title = Model\Portal\Category::find($cat_1);
     $homepage_category_1 = Model\Portal\Article::categoryId($cat_1);
     $homepage_category_2_title = Model\Portal\Category::find($cat_2);
     $homepage_category_2_a = Model\Portal\Article::categoryId($cat_2);
     $homepage_category_2_b = Model\Portal\Article::categoryId($cat_2);
     $homepage_category_3_title = Model\Portal\Category::find($cat_3);
     $homepage_category_3 = Model\Portal\Article::categoryId($cat_3);
     $homepage_category_4_title = Model\Portal\Category::find($cat_4);
     $homepage_category_4 = Model\Portal\Article::categoryId($cat_4);
     $data = array('homepage_category_1_title' => $homepage_category_1_title ? $homepage_category_1_title->name : 'No Category', 'homepage_category_1' => $homepage_category_1->count() ? $homepage_category_1->take(10)->latest('date')->get() : collect([]), 'homepage_category_1_link' => $homepage_category_1_title ? portal_url('category/show/' . $homepage_category_1_title->name) : portal_url(), 'homepage_category_2_title' => $homepage_category_2_title ? $homepage_category_2_title->name : 'No Category', 'homepage_category_2_a' => $homepage_category_2_a->count() ? $homepage_category_2_a->take(10)->latest('date')->get() : collect([]), 'homepage_category_2_b' => $homepage_category_2_b->count() ? $homepage_category_2_b->take(2)->skip(2)->latest('date')->get() : collect([]), 'homepage_category_2_link' => $homepage_category_2_title ? portal_url('category/show/' . $homepage_category_2_title->name) : portal_url(), 'homepage_category_3_title' => $homepage_category_3_title ? $homepage_category_3_title->name : 'No Category', 'homepage_category_3' => $homepage_category_3->count() ? $homepage_category_3->take(5)->latest('date')->get() : collect([]), 'homepage_category_3_link' => $homepage_category_3_title ? portal_url('category/show/' . $homepage_category_3_title->name) : portal_url(), 'homepage_category_4_title' => $homepage_category_4_title ? $homepage_category_4_title->name : 'No Category', 'homepage_category_4' => $homepage_category_4->count() ? $homepage_category_4->take(10)->latest('date')->get() : collect([]), 'homepage_category_4_link' => $homepage_category_4_title ? portal_url('category/show/' . $homepage_category_4_title->name) : portal_url(), 'links' => $this->Mod_link->read(), 'latest' => Model\Portal\Article::latest('date')->limit(10)->get());
     $this->template->set('slider', true);
     $this->template->set('railnews', true);
     $this->template->set('sidebar', true);
     $this->template->set('sidebarCategory', false);
     $this->template->build('index', $data);
 }
 /**
  * Suggest Records based on related object ids, using the Solr's mlt search.
  * Rely on Solr's score.
  * @return array suggested_records
  */
 function suggest()
 {
     //construct the query string
     $str = 'id:' . $this->ro->id;
     $this->ro->processTemporal();
     $earliest = '*';
     $latest = '*';
     if ($this->ro->getEarliestAsYear() != 9999999) {
         $earliest = $this->ro->getEarliestAsYear();
     }
     if ($this->ro->getLatestAsYear() != 0) {
         $latest = $this->ro->getLatestAsYear();
     }
     //call SOLR library
     $suggestions = array();
     $this->minYear = 9999999;
     $this->maxYear = 0;
     $maxRows = 50;
     if ($earliest != '*' || $latest != '*') {
         $str = 'date_from:[' . $earliest . '-01-01T00:00:00Z TO ' . $latest . '-12-31T23:59:59Z] AND date_to:[' . $earliest . '-01-01T00:00:00Z TO ' . $latest . '-12-31T23:59:59Z]';
         $ci =& get_instance();
         $ci->load->library('solr');
         $ci->solr->init();
         $ci->solr->init()->setOpt('q', $str)->setOpt('rows', '50')->setOpt('fq', '-id:' . $this->ro->id)->setOpt('fq', 'class:collection')->setOpt('fl', 'id,key,slug,title,score');
         $result = $ci->solr->executeSearch(true);
         if ($result['response']['numFound'] > 0) {
             $maxScore = floatval($result['response']['maxScore']);
             $intScore = 0;
             foreach ($result['response']['docs'] as $doc) {
                 $doc['score'] = $doc['score'] / $maxScore * (1 - $intScore / $maxRows);
                 $intScore++;
                 $doc['RDAUrl'] = portal_url($doc['slug'] . '/' . $doc['id']);
                 $suggestions[] = $doc;
             }
         }
     }
     return $suggestions;
 }
Exemplo n.º 12
0
 function getContributorText()
 {
     $this->_CI->load->library('solr');
     $this->_CI->solr->setOpt('q', '*:*');
     $this->_CI->solr->setOpt('fq', 'group:("' . $this->ro->getAttribute('group') . '")');
     //$this->_CI->solr->setOpt('rows','0');
     $this->_CI->solr->setFacetOpt('field', 'class');
     $this->_CI->solr->setFacetOpt('field', 'subject_value_resolved');
     $this->_CI->solr->setFacetOpt('mincount', '1');
     $this->_CI->solr->executeSearch();
     $groupName = $this->ro->getAttribute('group');
     //$group = (string)$group;
     //we want to select all published registry objects which have the same group faceted by class;
     $classes = $this->_CI->solr->getFacetResult('class');
     foreach ($classes as $class => $num) {
         $contributorData['contents'][$class] = $num;
     }
     $collectionCount = isset($contributorData['contents']['collection']) ? $contributorData['contents']['collection'] : 0;
     if ($collectionCount == 0) {
         $collectionCount = 'no';
         $collectionWord = 'collections';
     } elseif ($collectionCount == 1) {
         $collectionWord = 'collection';
         $collectionCount = 'one';
     } else {
         $collectionWord = 'collections';
     }
     //we want to select all subjects of records which have this as a contibuting group;
     $subjects = $this->_CI->solr->getFacetResult('subject_value_resolved');
     $subjectCount = array();
     foreach ($subjects as $subject => $num) {
         $contributorData['subjects'][$subject] = $num;
         $subjectCount[] = $subject;
     }
     $subjectNum = count($subjectCount);
     $subjectStr = '';
     $subjectWord = 'areas';
     if ($subjectNum < 1 || $collectionCount == 'no') {
         $subjectStr = ".";
     } elseif ($subjectNum == 1) {
         $subjectWord = 'area';
         $subjectStr = ', which cover the subject ' . $subjectWord . ' <a href="' . portal_url() . 'search#!/tab=all/group=' . rawurlencode($groupName) . '/s_subject_value_resolved=' . rawurlencode($subjectCount[0]) . '">' . $subjectCount[0] . '</a>.';
     } elseif ($subjectNum == 2) {
         $subjectStr = ', which cover 	' . $subjectNum . ' subject ' . $subjectWord . ' including <a href="' . portal_url() . 'search#!/tab=all/group=' . rawurlencode($groupName) . '/s_subject_value_resolved=' . rawurlencode($subjectCount[0]) . '">' . $subjectCount[0] . '</a> and <a href="' . portal_url() . 'search#!/tab=all/group=' . rawurlencode($groupName) . '/s_subject_value_resolved=' . rawurlencode($subjectCount[1]) . '">' . $subjectCount[1] . '</a>.';
     } else {
         if ($subjectNum >= 100) {
             $subjectStr = ', which cover over ' . $subjectNum . ' subject ' . $subjectWord . ' including <a href="' . portal_url() . 'search#!/tab=all/group=' . rawurlencode($groupName) . '/s_subject_value_resolved=' . rawurlencode($subjectCount[0]) . '">' . $subjectCount[0] . '</a>, <a href="' . portal_url() . 'search#!/tab=all/group=' . rawurlencode($groupName) . '/s_subject_value_resolved=' . rawurlencode($subjectCount[1]) . '">' . $subjectCount[1] . '</a> and <a href="' . portal_url() . 'search#!/tab=all/group=' . rawurlencode($groupName) . '/s_subject_value_resolved=' . rawurlencode($subjectCount[2]) . '">' . $subjectCount[2] . '</a>.';
         } else {
             $subjectStr = ', which cover ' . $subjectNum . ' subject ' . $subjectWord . ' including <a href="' . portal_url() . 'search#!/tab=all/group=' . rawurlencode($groupName) . '/s_subject_value_resolved=' . rawurlencode($subjectCount[0]) . '">' . $subjectCount[0] . '</a>, <a href="' . portal_url() . 'search#!/tab=all/group=' . rawurlencode($groupName) . '/s_subject_value_resolved=' . rawurlencode($subjectCount[1]) . '">' . $subjectCount[1] . '</a> and <a href="' . portal_url() . 'search#!/tab=all/group=' . rawurlencode($groupName) . '/s_subject_value_resolved=' . rawurlencode($subjectCount[2]) . '">' . $subjectCount[2] . '</a>.';
         }
     }
     //we want to select all groups of which have this as a contibuting group;
     $this->_CI->solr->setOpt('fq', 'type:("group")');
     $groups = $this->_CI->solr->executeSearch();
     $contributorData['groups'] = array();
     foreach ($groups->{'response'}->{'docs'} as $group) {
         $contributorData['groups'][$group->{'list_title'}] = '';
     }
     $groupCount = count($contributorData['groups']);
     if ($groupCount == 1 || $groupCount == 0) {
         $groupStr = '';
     } else {
         $groupStr = $groupCount . '	 research groups have been actively involved in collecting data and creating metadata records for the data.';
     }
     $theText = '<p>To date, ' . $groupName . ' has ';
     if ($collectionCount != 'no') {
         $theText .= '<a id="hp-count-collection" href="' . portal_url() . 'search#!/tab=collection/group=' . rawurlencode($groupName) . '">' . $collectionCount . ' ' . $collectionWord . '</a> in RDA';
     } else {
         $theText .= ' ' . $collectionCount . ' ' . $collectionWord . ' in RDA';
     }
     $theText .= $subjectStr . ' ' . $groupStr . ' All the Collections, Parties, Activities and Services associated with ' . rawurldecode($groupName) . '  can be accessed from the Registry Contents box on the right hand side of this page.</p>';
     return $theText;
 }
Exemplo n.º 13
0
function identifierResolution($identifier, $type)
{
    switch ($type) {
        case 'doi':
            if (!strpos($identifier, "doi.org/")) {
                $identifier_href = "http://dx.doi.org/" . $identifier;
            } else {
                $identifier_href = "http://dx.doi.org/" . substr($identifier, strpos($identifier, "doi.org/") + 8);
            }
            $identifiers['href'] = $identifier_href;
            $identifiers['display_text'] = strtoupper($type);
            $identifiers['hover_text'] = 'Resolve this DOI';
            $identifiers['display_icon'] = '<img class="identifier_logo" src= ' . portal_url() . 'assets/core/images/icons/doi_icon.png alt="DOI Link"/>';
            return $identifiers;
            break;
        case 'ark':
            $identifiers['href'] = '';
            $identifiers['display_icon'] = '';
            if (str_replace('http://', '', str_replace('https://', '', $identifier)) != $identifier && str_replace('/ark:/', '', $identifier) != $identifier) {
                $identifiers['href'] = $identifier;
                $identifiers['display_icon'] = '<img class="identifier_logo" src= ' . portal_url() . 'assets/core/images/icons/external_link.png alt="External Link"/>';
            } elseif (strpos($identifier, '/ark:/') > 1) {
                $identifiers['href'] = 'http://' . $identifier;
                $identifiers['display_icon'] = '<img class="identifier_logo" src= ' . portal_url() . 'assets/core/images/icons/external_link.png alt="External Link"/>';
            }
            $identifiers['display_text'] = 'ARK';
            $identifiers['hover_text'] = 'Resolve this ARK identifier';
            return $identifiers;
            break;
        case 'orcid':
            if (!strpos($identifier, "orcid.org/")) {
                $identifier_href = "http://orcid.org/" . $identifier;
            } else {
                $identifier_href = "http://orcid.org/" . substr($identifier, strpos($identifier, "orcid.org/") + 10);
            }
            $identifiers['href'] = $identifier_href;
            $identifiers['display_text'] = 'ORCID';
            $identifiers['display_icon'] = '<img class="identifier_logo" src= ' . portal_url() . 'assets/core/images/icons/orcid_icon.png alt="ORCID Link"/>';
            $identifiers['hover_text'] = 'Resolve this ORCID';
            return $identifiers;
            break;
        case 'AU-ANL:PEAU':
            if (!strpos($identifier, "nla.gov.au/")) {
                $identifier_href = "http://nla.gov.au/" . $identifier;
            } else {
                $identifier_href = "http://nla.gov.au/" . substr($identifier, strpos($identifier, "nla.gov.au/") + 11);
            }
            $identifiers['href'] = $identifier_href;
            $identifiers['display_text'] = 'NLA';
            $identifiers['display_icon'] = '<img class="identifier_logo" src= ' . portal_url() . 'assets/core/images/icons/nla_icon.png alt="NLA Link"/>';
            $identifiers['hover_text'] = 'View the record for this party in Trove';
            return $identifiers;
            break;
        case 'handle':
            if (strpos($identifier, "dl:") > 0) {
                $identifier_href = "http://hdl.handle.net/" . substr($identifier, strpos($identifier, "hdl:") + 4);
            } elseif (strpos($identifier, "dl.handle.net/") > 0) {
                $identifier_href = "http://hdl.handle.net/" . substr($identifier, strpos($identifier, "hdl.handle.net/") + 15);
            } else {
                $identifier_href = "http://hdl.handle.net/" . $identifier;
            }
            $identifiers['href'] = $identifier_href;
            $identifiers['display_text'] = 'Handle';
            $identifiers['display_icon'] = '<img class="identifier_logo" src= ' . portal_url() . 'assets/core/images/icons/handle_icon.png alt="Handle Link"/>';
            $identifiers['hover_text'] = 'Resolve this handle';
            return $identifiers;
            break;
        case 'purl':
            if (strpos($identifier, "url.org/") < 1) {
                $identifier_href = "http://purl.org/" . $identifier;
            } else {
                $identifier_href = "http://purl.org/" . substr($identifier, strpos($identifier, "purl.org/") + 9);
            }
            $identifiers['href'] = $identifier_href;
            $identifiers['display_text'] = 'PURL';
            $identifiers['display_icon'] = '<img class="identifier_logo" src= ' . portal_url() . 'assets/core/images/icons/external_link.png alt="External Link"/>';
            $identifiers['hover_text'] = 'Resolve this PURL';
            return $identifiers;
            break;
        case 'uri':
            $identifiers['href'] = $identifier;
            $identifiers['display_text'] = strtoupper($type);
            $identifiers['hover_text'] = 'Resolve this URI';
            $identifiers['display_icon'] = '<img class="identifier_logo" src= ' . portal_url() . 'assets/core/images/icons/external_link.png alt="External Link"/>';
            return $identifiers;
            break;
        case 'urn':
            break;
        case 'local':
            $identifiers['display_text'] = 'Local';
            return $identifiers;
            break;
        case 'isil':
            $identifiers['display_text'] = 'ISIL';
            return $identifiers;
            break;
        case 'abn':
            $identifiers['display_text'] = 'ABN';
            return $identifiers;
            break;
        case 'arc':
            $identifiers['display_text'] = 'ARC';
            return $identifiers;
            break;
        default:
            return false;
            break;
    }
}
Exemplo n.º 14
0
 function orcid_works()
 {
     header('Cache-Control: no-cache, must-revalidate');
     header('Content-type: application/json');
     $data = file_get_contents("php://input");
     $data = json_decode($data, true);
     $data = $data['data'];
     set_exception_handler('json_exception_handler');
     //load relevant models and libraries
     $this->load->model('registry_object/registry_objects', 'ro');
     $this->load->library('solr');
     $this->load->library('Orcid_api', 'orcid');
     //suggested
     $result['suggested'] = array();
     $suggested_collections = array();
     $already_checked = array();
     //find parties of similar names
     $this->solr->setOpt('fq', '+class:party');
     $this->solr->setOpt('fq', '+title_search:(' . $data['last_name'] . ')');
     $this->solr->executeSearch();
     if ($this->solr->getNumFound() > 0) {
         $result = $this->solr->getResult();
         foreach ($result->{'docs'} as $d) {
             if (!in_array($d->{'id'}, $already_checked)) {
                 $ro = $this->ro->getByID($d->{'id'});
                 $connections = $ro->getConnections(true, 'collection');
                 if (isset($connections[0]['collection']) && sizeof($connections[0]['collection']) > 0) {
                     $suggested_collections = array_merge($suggested_collections, $connections[0]['collection']);
                 }
                 array_push($already_checked, $d->{'id'});
                 unset($ro);
             }
         }
     }
     //find parties that have the same orcid_id
     $this->solr->clearOpt('fq');
     $this->solr->setOpt('fq', '+class:party');
     $this->solr->setOpt('fq', '+identifier_value:(' . $data['orcid_id'] . ')');
     $this->solr->executeSearch();
     if ($this->solr->getNumFound() > 0) {
         $result = $this->solr->getResult();
         foreach ($result->{'docs'} as $d) {
             if (!in_array($d->{'id'}, $already_checked)) {
                 $ro = $this->ro->getByID($d->{'id'});
                 $connections = $ro->getConnections(true, 'collection');
                 if (isset($connections[0]['collection']) && sizeof($connections[0]['collection']) > 0) {
                     $suggested_collections = array_merge($suggested_collections, $connections[0]['collection']);
                 }
                 array_push($already_checked, $d->{'id'});
                 unset($ro);
             }
         }
     }
     //find collection that has a relatedInfo/citationInfo like the orcid_id
     $this->solr->clearOpt('fq');
     $this->solr->setOpt('fq', 'fulltext:(' . $data['orcid_id'] . ')');
     $this->solr->setOpt('fq', 'class:(collection)');
     $this->solr->executeSearch();
     if ($this->solr->getNumFound() > 0) {
         $result = $this->solr->getResult();
         foreach ($result->{'docs'} as $d) {
             if (!in_array($d->{'id'}, $already_checked)) {
                 $new = array();
                 array_push($new, array('registry_object_id' => $d->{'id'}, 'title' => $d->{'display_title'}, 'key' => $d->{'key'}, 'slug' => $d->{'slug'}));
                 $suggested_collections = array_merge($suggested_collections, $new);
                 array_push($already_checked, $d->{'id'});
                 unset($ro);
             }
         }
     }
     $result = array();
     //imported
     $imported = $this->ro->getByAttribute('imported_by_orcid', $data['orcid_id']);
     $imported_ids = array();
     if ($imported && is_array($imported)) {
         foreach ($imported as $i) {
             $result['works'][] = array('type' => 'imported', 'id' => $i->id, 'title' => $i->title, 'key' => $i->key, 'url' => portal_url($i->slug), 'imported' => true, 'in_orcid' => false);
             $imported_ids[] = $i->id;
         }
     }
     //suggested
     foreach ($suggested_collections as $s) {
         $result['works'][] = array('type' => 'suggested', 'id' => $s['registry_object_id'], 'title' => $s['title'], 'key' => $s['key'], 'url' => portal_url($s['slug']), 'imported' => in_array($s['registry_object_id'], $imported_ids), 'in_orcid' => false);
     }
     $bio = json_decode($this->orcid_api->get_full(), true);
     if ($bio && isset($bio['orcid-profile']['orcid-activities']['orcid-works']['orcid-work'])) {
         $works = $bio['orcid-profile']['orcid-activities']['orcid-works']['orcid-work'];
         foreach ($works as $w) {
             $title = $w['work-title']['title']['value'];
             foreach ($result['works'] as &$s) {
                 if ($title == $s['title']) {
                     $s['in_orcid'] = true;
                 }
             }
         }
     }
     echo json_encode($result);
 }
Exemplo n.º 15
0
 /**
  * Get A Record
  * 
  * 
  * @author Minh Duc Nguyen <*****@*****.**>
  * @package ands/registryobject
  * @param registry object ID
  * @return [JSON] of a single registry object
  * 
  */
 public function get_record($id)
 {
     $this->load->model('registry_objects', 'ro');
     $ro = $this->ro->getByID($id);
     $ro->enrich();
     $data['xml'] = html_entity_decode($ro->getRif());
     $data['extrif'] = html_entity_decode($ro->getExtRif());
     $data['solr'] = json_encode($ro->indexable_json());
     //$data['view'] = $ro->transformForHtml();
     $data['id'] = $ro->id;
     $data['title'] = $ro->getAttribute('list_title');
     $data['attributes'] = $ro->getAttributes();
     $data['revisions'] = $ro->getAllRevisions();
     //preview link for iframe in preview, show published view if published, show draft preview if in draft
     $data['preview_link'] = portal_url() . $ro->slug;
     $jsonData = array();
     $jsonData['status'] = 'OK';
     $jsonData['ro'] = $data;
     $jsonData = json_encode($jsonData);
     echo $jsonData;
 }
Exemplo n.º 16
0
			    <hr/>	

			    <!-- OAI-PMH -->
			    <div class="box-content">
			    	
			    	<h3>OAI-PMH</h3>
			    	
			    	<div>
			    		<blockquote>
							<p class="lead">A low-barrier mechanism for repository interoperability (<a href="http://www.openarchives.org/pmh/" target="_blank">Open Archives Initiative Protocol for Metadata Harvesting (OAI-PMH)</a>)</p>
						</blockquote>
						<dl class="dl-horizontal">
						  <dt>Service URL: </dt>
						  <dd><code><?php 
echo portal_url('services/oai/');
?>
</code></dd>
						</dl>
						<p>
				    		Records can be harvested from OAI-PMH in <?php 
echo anchor("services/oai?verb=ListSets", "OAI Sets", array("target" => "_blank"));
?>
 according to their group, data source or registry object class.
				    	</p>
					</div>
				
			    </div>		    
			    
			    
		</div>
Exemplo n.º 17
0
 public function get_mmr_menu()
 {
     // header('Cache-Control: no-cache, must-revalidate');
     // header('Content-type: application/json');
     $this->load->model('data_source/data_sources', 'ds');
     $this->load->model('registry_object/registry_objects', 'ro');
     $data_source_id = $this->input->post('data_source_id');
     ds_acl_enforce($data_source_id);
     $status = $this->input->post('status');
     $selecting_status = $this->input->post('selecting_status') ? $this->input->post('selecting_status') : false;
     $affected_ids = $this->input->post('affected_ids') ? $this->input->post('affected_ids') : array();
     $data_source = $this->ds->getByID($data_source_id);
     if ($selecting_status != $status) {
         $affected_ids = array();
     }
     $menu = array();
     if (sizeof($affected_ids) == 0) {
         $menu['nothing'] = 'You must first select a record';
     } else {
         if (sizeof($affected_ids) == 1) {
             $menu['view'] = 'View Record';
         }
     }
     $hasFlag = false;
     $hasGold = false;
     foreach ($affected_ids as $id) {
         $ro = $this->ro->getByID($id);
         if ($ro) {
             if ($ro->flag == 't') {
                 $hasFlag = true;
             }
             if ($ro->gold_status_flag == 't') {
                 $hasGold = true;
             }
         }
     }
     //QA and Auto Publish check
     $qa = $data_source->qa_flag == 't' ? true : false;
     $manual_publish = $data_source->manual_publish == 't' || $data_source->manual_publish == DB_TRUE ? true : false;
     if (sizeof($affected_ids) >= 1) {
         if ($hasFlag) {
             $menu['un_flag'] = 'Remove Flag';
         } else {
             $menu['flag'] = 'Flag';
         }
         switch ($status) {
             case 'DRAFT':
                 if ($qa) {
                     $menu['to_submit'] = 'Submit for Assessment';
                 } else {
                     if ($manual_publish) {
                         $menu['to_approve'] = 'Approve';
                     } else {
                         $menu['to_publish'] = 'Publish';
                     }
                 }
                 $menu['edit'] = 'Edit Record';
                 $menu['delete'] = 'Delete Record';
                 $menu['preview'] = 'Preview in RDA';
                 break;
             case 'MORE_WORK_REQUIRED':
                 $menu['to_draft'] = 'Move to Draft';
                 $menu['edit'] = 'Edit Record';
                 $menu['delete'] = 'Delete Record';
                 $menu['preview'] = 'Preview in RDA';
                 break;
             case 'SUBMITTED_FOR_ASSESSMENT':
                 if ($this->user->hasFunction('REGISTRY_STAFF')) {
                     $menu['to_assess'] = 'Assessment In Progress';
                     $menu['to_draft'] = 'Revert to Draft';
                 }
                 if ($this->user->hasFunction('REGISTRY_SUPERUSER')) {
                     $menu['edit'] = '* Edit Record';
                     $menu['delete'] = '* Delete Record';
                 }
                 $menu['preview'] = 'Preview in RDA';
                 break;
             case 'ASSESSMENT_IN_PROGRESS':
                 if ($this->user->hasFunction('REGISTRY_STAFF')) {
                     if ($manual_publish) {
                         $menu['to_approve'] = 'Approve';
                     } else {
                         $menu['to_publish'] = 'Publish';
                     }
                     $menu['to_moreworkrequired'] = 'More Work Required';
                     if ($this->user->hasFunction('REGISTRY_SUPERUSER')) {
                         $menu['to_draft'] = '* Revert to Draft';
                         $menu['edit'] = '* Edit Record';
                         $menu['delete'] = '* Delete Record';
                     }
                     $menu['preview'] = 'Preview in RDA';
                 }
                 break;
             case 'APPROVED':
                 $menu['edit'] = 'Edit Record';
                 $menu['to_publish'] = 'Publish';
                 $menu['delete'] = 'Delete Record';
                 $menu['preview'] = 'Preview in RDA';
                 break;
             case 'PUBLISHED':
                 $menu['to_draft'] = 'Create Draft Copy';
                 $menu['edit'] = 'Edit Record';
                 if ($this->user->hasFunction('REGISTRY_STAFF')) {
                     if ($hasGold) {
                         $menu['un_set_gold_status_flag'] = 'Remove Gold Status';
                     } else {
                         $menu['set_gold_status_flag'] = 'Set Gold Status';
                     }
                 }
                 $menu['delete'] = 'Delete Record';
                 $menu['rdaview'] = 'View in RDA';
                 break;
         }
         $menu['select_none'] = 'Deselect Record(s)';
     }
     $html = '';
     $target = '';
     $html .= '<ul class="nav nav-tabs nav-stacked">';
     foreach ($menu as $action => $display) {
         if ($action != "nothing") {
             if (sizeof($affected_ids) == 1 && $action == 'view') {
                 $ro = $this->ro->getByID($affected_ids[0]);
                 $href = base_url('registry_object/view/' . $ro->id);
             } elseif (sizeof($affected_ids) == 1 && $action == 'preview') {
                 $ro = $this->ro->getByID($affected_ids[0]);
                 $href = portal_url() . 'view/?id=' . $ro->id;
                 $target = 'target="_blank"';
             } elseif (sizeof($affected_ids) == 1 && $action == 'rdaview') {
                 $ro = $this->ro->getByID($affected_ids[0]);
                 $href = portal_url() . $ro->slug;
                 $target = 'target="_blank"';
             } else {
                 $href = 'javascript:;';
             }
             $html .= '<li><a tabindex="-1" href="' . $href . '" class="op" ' . $target . ' action="' . $action . '" status="' . $status . '">' . $display . '</a></li>';
         } else {
             $html .= $display . "<br/><small><em>(the block around the record turns blue when selected)</em></small>";
         }
     }
     $html .= '</ul>';
     echo $html;
 }
Exemplo n.º 18
0
 public function getLinkAttribute()
 {
     return portal_url('category/show/' . $this->name);
 }
Exemplo n.º 19
0
</div>

<div id="view_page_template" class="hide">
	<div class="content-header">
		<h1 ng-dblclick="editPageTitle = true" ng-hide="editPageTitle">{{page.title}}</h1>
		<h1 ng-show="editPageTitle">
			<form class="form form-horizontal">
				<input type="text" ng-model="page.title">
				<button class="btn btn-small" ng-click="editPageTitle = false"><i class="icon icon-ok"></i></button>
			</form>
		</h1>
		<div class="btn-group">
			<a class="btn btn-large" ng-click="save()"><i class="icon icon-hdd"></i> Save</a>
			<a class="btn btn-large" ng-click="config=true"><i class="icon icon-wrench"></i> Config</a>
			<a class="btn btn-large" href="<?php 
echo portal_url('theme/{{page.slug}}');
?>
" target="_blank"><i class="icon icon-eye-open"></i> Preview</a>
			<a class="btn btn-large btn-danger" tip="Delete" ng-click="deleting('true')"><i class="icon-white icon-trash"></i></a>
		</div>
	</div>
	<div id="breadcrumb" style="clear:both;">
		<?php 
echo anchor(registry_url('auth/dashboard'), '<i class="icon-home"></i> Home');
?>
		<a href="#/">Theme CMS</a>
		<a href="#/view/{{page.slug}}" class="current">{{page.title}}</a>
		<div class='pull-right muted' style="margin:10px 30px 0px 0px;"><small>{{saved_msg}}</small></div>
	</div>
	
	<div class="container-fluid">
Exemplo n.º 20
0
    <!-- Mustache Template that should be used everywhere-->
    <div id="error-template" class="hide">
        <div class="alert alert-error">{{{.}}}</div>
    </div>

    <!-- The javascripts Libraries
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script>
        localStorage.clear();
        var base_url = '<?php 
echo $base_url;
?>
';
        var portal_url = '<?php 
echo portal_url();
?>
';
        var apps_url = '<?php 
echo apps_url();
?>
';
        var real_base_url = "<?php 
echo $this->config->item('default_base_url');
?>
";
        var suffix = '<?php 
echo url_suffix();
?>
';
        var editor = '';
Exemplo n.º 21
0
									</div>

								</form>
								<div ng-show="search_result[c.search.id]">
									<div ng-show="search_result[c.search.id].data.numFound > 0">
										<ul>
											<li ng-repeat="doc in search_result[c.search.id].data.result.docs">
												<a href="<?php 
echo portal_url();
?>
{{doc.slug}}" target="_blank">{{doc.display_title}}</a>
												<a href="" tip="Boost This Record" ng-click="addBoost(c, doc.key)"><i class="icon icon-arrow-up"></i></a>
											</li>
										</ul>
										<a target="_blank" href="<?php 
echo portal_url('search');
?>
#!/{{search_result[c.search.id].filter_query}}">
											<span ng-show="c.search.view_search_text">{{c.search.view_search_text}} </span>
											<span ng-hide="c.search.view_search_text">View Full Search </span>
											({{search_result[c.search.id].data.result.numFound}} results)
										</a>
									</div>
									<div ng-show="search_result[c.search.id].data.numFound == 0">
										There are no search result!
									</div>
								</div>
							</div>

							<div ng-show="c.type == 'facet'">
								<form action="" class="form-inline">
Exemplo n.º 22
0
    if ($this->user->hasFunction('REGISTRY_USER') && mod_enabled('registry')) {
        ?>
                <li class="btn btn-inverse dropdown">
                  <a class="dropdown-toggle" data-toggle="dropdown" href="#">My Data <b class="caret"></b></a>
                  <ul class="dropdown-menu pull-right">
                    <li class=""><?php 
        echo anchor(registry_url('data_source/manage'), 'Manage My Data Sources');
        ?>
</li>
                    <li class=""><?php 
        echo anchor(registry_url('registry_object/add'), '<i class="icon icon-plus"></i> Add New Record');
        ?>
</li>
                    <li class="divider"></li>
                    <li class=""><?php 
        echo anchor(portal_url(), '<i class="icon-globe icon"></i> Research Data Australia', array("target" => "_blank"));
        ?>
</li>
                    <li class="divider"></li>
                    <li class=""><?php 
        echo anchor(registry_url('registry_object/gold_standard'), 'Gold Standard Records');
        ?>
</li>
                  </ul>
                </li>
              <?php 
    }
    ?>

              <?php 
    if (($this->user->hasFunction('PIDS_USER') || $this->user->hasFunction('DOI_USER')) && (mod_enabled('pids') || mod_enabled('mydois'))) {
Exemplo n.º 23
0
 function getSourceUrl($output = null)
 {
     $sourceUrl = '';
     $query = '';
     if ($this->gXPath->evaluate("count(//ro:collection/ro:citationInfo/ro:citationMetadata/ro:identifier[@type='doi'])") > 0) {
         $query = "//ro:collection/ro:citationInfo/ro:citationMetadata/ro:identifier[@type='doi']";
         $type = 'doi';
     } elseif ($this->gXPath->evaluate("count(//ro:collection/ro:citationInfo/ro:citationMetadata/ro:identifier[@type='handle'])") > 0) {
         $query = "//ro:collection/ro:citationInfo/ro:citationMetadata/ro:identifier[@type='handle']";
         $type = 'handle';
     } elseif ($this->gXPath->evaluate("count(//ro:collection/ro:citationInfo/ro:citationMetadata/ro:identifier[@type='uri'])") > 0) {
         $query = "//ro:collection/ro:citationInfo/ro:citationMetadata/ro:identifier[@type='uri']";
         $type = 'uri';
     } elseif ($this->gXPath->evaluate("count(//ro:collection/ro:citationInfo/ro:citationMetadata/ro:identifier[@type='purl'])") > 0) {
         $query = "//ro:collection/ro:citationInfo/ro:citationMetadata/ro:identifier[@type='purl']";
         $type = 'purl';
     } elseif ($this->gXPath->evaluate("count(//ro:collection/ro:identifier[@type='doi'])") > 0) {
         $query = "//ro:collection/ro:identifier[@type='doi']";
         $type = 'doi';
     } elseif ($this->gXPath->evaluate("count(//ro:collection/ro:identifier[@type='handle'])") > 0) {
         $query = "//ro:collection/ro:identifier[@type='handle']";
         $type = 'handle';
     } elseif ($this->gXPath->evaluate("count(//ro:collection/ro:identifier[@type='uri'])") > 0) {
         $query = "//ro:collection/ro:identifier[@type='uri']";
         $type = 'uri';
     } elseif ($this->gXPath->evaluate("count(//ro:collection/ro:identifier[@type='purl'])") > 0) {
         $query = "//ro:collection/ro:identifier[@type='purl']";
         $type = 'purl';
     } elseif ($this->gXPath->evaluate("count(//ro:collection/ro:citationInfo/ro:citationMetadata/ro:url)") > 0) {
         $query = "//ro:collection/ro:citationInfo/ro:citationMetadata/ro:url";
         $type = 'url';
     } elseif ($this->gXPath->evaluate("count(//ro:collection/ro:location/ro:address/ro:electronic[@type='url'])") > 0) {
         $query = "//ro:collection/ro:location/ro:address/ro:electronic[@type='url']";
         $type = 'url';
     }
     if ($query != '') {
         $urls = $this->gXPath->query($query);
         foreach ($urls as $url) {
             $sourceUrl = $url->nodeValue;
             if ($output == 'endNote') {
                 $resolved = identifierResolution($sourceUrl, $type);
                 $sourceUrl = $resolved['href'];
             } elseif ($output == 'coins') {
                 if (strpos($sourceUrl, "doi.org/")) {
                     $sourceUrl = "info:doi" . substr($sourceUrl, strpos($sourceUrl, "doi.org/") + 8);
                 } elseif ($type == 'doi') {
                     $sourceUrl = "info:doi" . $sourceUrl;
                 }
             }
         }
     } else {
         if ($output == 'endNote') {
             $sourceUrl = portal_url();
         }
     }
     return $sourceUrl;
 }
 private function processSolrResult($result, &$suggestions, $score_override, $class, $relation_type, $maxRows)
 {
     $intScore = 0;
     $maxScore = floatval($result['response']['maxScore']);
     foreach ($result['response']['docs'] as $doc) {
         if (!in_array_r($doc, $suggestions)) {
             $doc['score'] = $doc['score'] / $maxScore * (1 - $intScore / $maxRows * $score_override);
             $intScore++;
             $doc['relation_type'] = $relation_type;
             $doc['class'] = $class;
             $doc['RDAUrl'] = portal_url($doc['slug'] . '/' . $doc['id']);
             $suggestions[] = $doc;
         }
     }
 }
Exemplo n.º 25
0
 function saveData($name = '', $data = array())
 {
     $this->portal_db = $this->load->database('portal', TRUE);
     $published = $this->fetchData($name, 'PUBLISHED');
     $drafts = $this->fetchData($name, 'DRAFT');
     if (!isset($data['status'])) {
         $data['status'] = 'DRAFT';
     }
     if (!$drafts) {
         //create a draft
         $data = array('name' => $name, 'authorative_datasource' => '0', 'status' => $data['status'], 'data' => json_encode($data['data'], JSON_FORCE_OBJECT), 'date_modified' => date("Y-m-d H:i:s"), 'modified_who' => $this->user->localIdentifier());
         $result = $this->portal_db->insert('contributor_pages', $data);
     } elseif ($drafts && $data['status'] != 'PUBLISHED') {
         //update the draft
         $data = array('status' => $data['status'], 'data' => json_encode($data['data'], JSON_FORCE_OBJECT), 'date_modified' => date("Y-m-d H:i:s"), 'modified_who' => $this->user->localIdentifier());
         $this->portal_db->where('name', $name);
         $this->portal_db->where_in('status', array('DRAFT', 'REQUESTED'));
         $result = $this->portal_db->update('contributor_pages', $data);
     } elseif ($data['status'] == 'PUBLISHED') {
         //destroy all
         $this->portal_db->where('name', $name)->delete('contributor_pages');
         //create a PUBLISHED
         $data = array('name' => $name, 'authorative_datasource' => '0', 'status' => $data['status'], 'data' => json_encode($data['data'], JSON_FORCE_OBJECT), 'date_modified' => date("Y-m-d H:i:s"), 'modified_who' => $this->user->localIdentifier());
         $result = $this->portal_db->insert('contributor_pages', $data);
     }
     if ($data['status'] == 'REQUESTED') {
         //alert new contributor page
         ulog_email('Contributor Page requested to be Published', 'Contributor Page ' . $name . ' requested to be published. Link: ' . portal_url('group/cms/#/groups/' . $name));
     }
     return $result;
 }
<?php

$relatedSearchQuery = portal_url() . 'search/#!/related_' . $ro->core['class'] . '_id=' . $ro->core['id'];
if ($ro->identifiermatch && sizeof($ro->identifiermatch) > 0) {
    foreach ($ro->identifiermatch as $mm) {
        $relatedSearchQuery .= '/related_' . $ro->core['class'] . '_id=' . $mm['registry_object_id'];
    }
}
?>


@if($ro->relationships && isset($ro->relationships['party_one']))
    @foreach($ro->relationships['party_one'] as $col)
        @if($col['slug'] && $col['registry_object_id'])
        <?php 
$description = '';
if (isset($col['relation_description']) && $col['relation_description'] != '') {
    $description = 'tip="' . $col['relation_description'] . '"';
}
?>
        <a href="<?php 
echo base_url();
?>
{{$col['slug']}}/{{$col['registry_object_id']}}" {{$description}} class="ro_preview" ro_id="{{$col['registry_object_id']}}" style="margin-right:5px;">{{$col['title']}} <small>({{readable($col['relation_type'],$col['origin'],$ro->core['class'],$col['class'])}}) </small></a>
        @elseif(isset($col['identifier_relation_id']))
        <a href="<?php 
echo base_url();
?>
" class="ro_preview" identifier_relation_id="{{$col['identifier_relation_id']}}" ">{{$col['title']}} <small>({{readable($col['relation_type'],$col['origin'],$ro->core['class'],$col['class'])}}) </small></a>
        @endif
    @endforeach
Exemplo n.º 27
0
    function transformToEndnote()
    {
        $this->_CI->load->helper('normalisation');
        try {
            $xslt_processor = Transforms::get_extrif_to_endnote_transformer();
            $dom = new DOMDocument();
            $dom->loadXML(str_replace('&', '&amp;', $this->ro->getExtRif()), LIBXML_NOENT);
            $xslt_processor->setParameter('', 'dateHarvested', date("Y", $this->ro->created));
            $xslt_processor->setParameter('', 'dateRequested', date("Y-m-d"));
            $xslt_processor->setParameter('', 'portal_url', portal_url() . $this->ro->slug . "/" . $this->ro->id);
            $xml_output = $xslt_processor->transformToXML($dom);
            $authStr = '';
            //we want to post process the authors and funding name
            if (str_replace("%%%AU  - Anonymous", "", $xml_output) != $xml_output) {
                $relationshipTypeArray = array('hasPrincipalInvestigator', 'principalInvestigator', 'author', 'coInvestigator', 'isOwnedBy', 'hasCollector');
                $classArray = array('party');
                $authors = $this->ro->getRelatedObjectsByClassAndRelationshipType($classArray, $relationshipTypeArray);
                if (count($authors) > 0) {
                    foreach ($authors as $author) {
                        if ($author['status'] == PUBLISHED) {
                            $authStr .= "AU  - " . $author['title'] . "\n";
                        }
                    }
                } else {
                    $authStr = 'AU  - Anonymous';
                }
                if ($authStr == '') {
                    $authStr = 'AU  - Anonymous';
                }
                $xml_output = str_replace("%%%AU  - Anonymous", trim($authStr), $xml_output);
            } else {
                $authors = explode('%%%AU - ', $xml_output);
                for ($i = 1; $i < count($authors); $i++) {
                    $author = explode(' - AU%%%', $authors[$i]);
                    $author_object = $this->_CI->ro->getPublishedByKey(trim($author[0]));
                    if ($author_object->list_title) {
                        $xml_output = str_replace('%%%AU - ' . trim($author[0]) . ' - AU%%%', 'AU  - ' . $author_object->list_title, $xml_output);
                    } else {
                        $xml_output = str_replace('%%%AU - ' . trim($author[0]) . ' - AU%%%
', '', $xml_output);
                    }
                }
            }
            $funders = explode('%%%A4 - ', $xml_output);
            for ($i = 1; $i < count($funders); $i++) {
                $funder = explode(' - A4%%%', $funders[$i]);
                $grant_object = $this->_CI->ro->getPublishedByKey(trim($funder[0]));
                if ($grant_object && $grant_object->status == PUBLISHED) {
                    $grant_sxml = $grant_object->getSimpleXML(NULL, true);
                    // Handle the researcher IDs (using the normalisation_helper.php)
                    $grant_id = $grant_sxml->xpath("//ro:identifier[@type='arc'] | //ro:identifier[@type='nhmrc'] | //ro:identifier[@type='purl']");
                    $related_party = $grant_object->getRelatedObjectsByClassAndRelationshipType(array('party'), array('isFunderOf', 'isFundedBy'));
                    if (is_array($grant_id)) {
                        if (is_array($related_party) && isset($related_party[0])) {
                            $xml_output = str_replace('%%%A4 - ' . trim($funder[0]) . ' - A4%%%', 'A4  - ,' . $related_party[0]['title'], $xml_output);
                        } else {
                            $xml_output = str_replace('%%%A4 - ' . trim($funder[0]) . ' - A4%%%
', '', $xml_output);
                        }
                    } else {
                        $xml_output = str_replace('%%%A4 - ' . trim($funder[0]) . ' - A4%%%
', '', $xml_output);
                    }
                } else {
                    $xml_output = str_replace('%%%A4 - ' . trim($funder[0]) . ' - A4%%%
', '', $xml_output);
                }
            }
            return $xml_output;
        } catch (Exception $e) {
            echo "UNABLE TO TRANSFORM" . BR;
            echo "<pre>" . nl2br($e->getMessage()) . "</pre>" . BR;
        }
    }
    echo $ds->title;
    ?>
</td></tr>
							<tr><th>Key</th><td style="width:100%; word-break:break-all;"><?php 
    echo $ro->key;
    ?>
</td></tr>
							<?php 
    if ($this->user->hasFunction('REGISTRY_STAFF')) {
        ?>
								<tr><th>ID</th><td><?php 
        echo $ro->id;
        ?>
</td></tr>						
								<tr><th>URL "Slug"</th><td><?php 
        echo anchor(portal_url($ro->slug), $ro->slug);
        ?>
</td></tr>
							<?php 
    }
    ?>
							<tr><th>Last edited by</th><td><?php 
    echo $ro->getAttribute('created_who');
    ?>
</td></tr>
							<tr><th>Date last changed</th><td><?php 
    echo date("j F Y, g:i a", (int) $ro->getAttribute('updated'));
    ?>
</td></tr>
							<tr><th>Date created</th><td><?php 
    echo date("j F Y, g:i a", (int) $ro->getAttribute('created'));
Exemplo n.º 29
0
    ?>

			<div class="box">
				<div class="box-header clearfix">
					<h1>My Data Sources</h1>
				</div>
				<div class="box-content">
						<?php 
    if (!$this->user->hasFunction('REGISTRY_USER')) {
        echo '<p>You are not registered as a Data Source Administrator.</p>';
        if ($this->user->affiliations()) {
            echo '<small><span class="label label-warning"> &nbsp; ! &nbsp;</span> You are already registered as an affiliate with an organisation.</small><br/>';
            echo '<small><span class="label label-important"> &nbsp; ! &nbsp;</span> Please contact <a href="mailto:services@ands.org.au">services@ands.org.au</a> to register for a new Data Source.</small>';
        } else {
            echo '<br/><small><span class="label label-success"> &nbsp; ! &nbsp;</span> <strong> New Data Publishers </strong> <br/>
										<p>If your institution does not already <a target="_blank" href="' . portal_url('home/contributors') . '">contribute to Research Data Australia</a> (at the institutional level), 
										you may wish to use the <a href="' . registry_url('publish_my_data') . '"><b>Publish My Data self-service tool</b></a>.</p>
										<p><small><em>Note:</em> Publish My Data self-service is intended for use by researchers at organisations where there is no formal data archiving service and where ANDS has no distributed services in place. 
										Please first check for processes within your institution before using the self-service facility.</small></p></small><br/>';
        }
    } elseif (sizeof($data_sources) > 0) {
        echo '<ul>';
        $i = 0;
        for ($i = 0; $i < sizeof($data_sources) && $i < 7; $i++) {
            echo '<li><a href="' . registry_url('data_source/#!/view/' . $data_sources[$i]['data_source_id']) . '">' . $data_sources[$i]['title'] . "</a></li>";
        }
        echo '</ul>';
        if ($i < sizeof($data_sources)) {
            echo '<div style="margin-left:20px;">';
            echo '<select data-placeholder="Choose a Data Source to View" class="chzn-select" id="dashboard-datasource-chooser">';
            echo '	<option value=""></option>';