Example #1
0
 function canIngestHere($collection_pid)
 {
     global $user;
     module_load_include('php', 'Fedora_Repository', 'ObjectHelper');
     $objectHelper = new ObjectHelper();
     //get the childsecurity policy from the collection.
     $policyStream = $objectHelper->getStream($collection_pid, SECURITYCLASS::$SECURITYSTREAM, false);
     if ($policyStream == null) {
         //no child policy stream so collection is wide open to anyone to ingest, that has the permission ingest in Drupal.
         //maybe we should return false here?? would be more secure.
         return true;
     }
     $allowedUsersAndRoles = $this->getAllowedUsersAndRoles($policyStream);
     if (!$allowedUsersAndRoles) {
         //error processing stream so don't let them ingest here.
         return false;
     }
     $allowedUsers = $allowedUsersAndRoles["users"];
     $allowedRoles = $allowedUsersAndRoles["roles"];
     foreach ($user->roles as $role) {
         if (in_array($role, $allowedRoles)) {
             return true;
         }
     }
     if (in_array($user->name, $allowedUsers)) {
         return true;
     }
     return false;
 }
 function showQdc()
 {
     module_load_include('php', 'Fedora_Repository', 'ObjectHelper');
     $objectHelper = new ObjectHelper();
     //$returnValue['title']="Description";
     $content = $objectHelper->getQDC($this->pid);
     $collection_fieldset = array('#title' => t('Description'), '#collapsible' => TRUE, '#collapsed' => FALSE, '#value' => $content);
     return theme('fieldset', $collection_fieldset);
 }
Example #3
0
 private function getNid($pid)
 {
     module_load_include('php', 'Fedora_Repository', 'ObjectHelper');
     //get Nid from Pid
     $object = new ObjectHelper($pid);
     $spec = $object->getStream($pid, 'MAG', 0);
     $xml = new SimpleXMLElement($spec);
     $nid = implode($xml->xpath('//nid'));
     //		$urlNid = implode($xml->xpath('//nurl'));
     //		$strNid = explode('node/', $urlNid);
     //		$nid = $strNid[1];
     return $nid;
 }
Example #4
0
 function createPolicy($collectionPid, &$dom, &$rootElement)
 {
     module_load_include('php', 'Fedora_Repository', 'ObjectHelper');
     $objectHelper = new ObjectHelper();
     $dsid = 'CHILD_SECURITY';
     $policyStreamDoc = $objectHelper->getStream($collectionPid, $dsid, false);
     if (!isset($policyStreamDoc)) {
         return null;
         //there is no policy stream so object will not have a policy stream
     }
     try {
         $xml = new SimpleXMLElement($policyStreamDoc);
     } catch (Exception $e) {
         watchdog(t("Fedora_Repository"), t("Problem getting Security Policy!"), NULL, WATCHDOG_ERROR);
         drupal_set_message(t('Problem getting Security Policy! ') . $e->getMessage(), 'error');
         return false;
     }
     $policyElement = $dom->createDocumentFragment();
     if (!$policyElement) {
         drupal_set_message(t('error parsing security policy stream!'));
         watchdog(t("Fedora_Repository"), t("Error parsing security policy stream, could not parse policy stream!"), NULL, WATCHDOG_NOTICE);
         return false;
     }
     $dom->importNode($policyElement, true);
     $value = $policyElement->appendXML($policyStreamDoc);
     if (!$value) {
         drupal_set_message(t('error creating security policy stream!'));
         watchdog(t("Fedora_Repository"), t("Error creating security policy stream, could not parse collection policy template file!"), NULL, WATCHDOG_NOTICE);
         return false;
     }
     $ds1 = $dom->createElement("foxml:datastream");
     $rootElement->appendChild($ds1);
     $ds1->setAttribute("ID", "POLICY");
     $ds1->setAttribute("STATE", "A");
     $ds1->setAttribute("CONTROL_GROUP", "X");
     $ds1v = $dom->createElement("foxml:datastreamVersion");
     $ds1->appendChild($ds1v);
     $ds1v->setAttribute("ID", "POLICY.0");
     $ds1v->setAttribute("MIMETYPE", "text/xml");
     $ds1v->setAttribute("LABEL", "POLICY");
     //$ds1v->setAttribute("FORMAT_URI","info:fedora/fedora-system:format/xml.fedora.audit");
     $content = $dom->createElement("foxml:xmlContent");
     $ds1v->appendChild($content);
     $content->appendChild($policyElement);
     return true;
 }
Example #5
0
 public function initializeAssemblerFrom($sourceAssembler)
 {
     if (isset($sourceAssembler)) {
         if (!isset($this->assembler)) {
             $this->assembler = $this->initiateAssembler();
         }
         ObjectHelper::mergeWith($this->assembler, $sourceAssembler, TRUE);
     }
 }
    public static function finalizeDataSourcePreparation(EnvironmentMetaModel $environment_metamodel, DataSourceMetaData $datasource) {
        if (!isset($datasource->parentName)) {
            return;
        }

        $parentDataSource = $environment_metamodel->getDataSource($datasource->parentName);

        ObjectHelper::mergeWith($datasource, $parentDataSource, TRUE, ObjectHelper::EXISTING_PROPERTY_RULE__SKIP_IF_PRESENT);
    }
    public function initializeTypeFrom($sourceType, $replace = FALSE) {
        if ($replace) {
            $this->type = $this->initiateType();
        }

        if (isset($sourceType)) {
            ObjectHelper::mergeWith($this->type, $sourceType, TRUE);
        }
    }
Example #8
0
 private function _loadDBSession()
 {
     $db_session = new Gamesession_delegate($this->id);
     $db_session->load();
     if (true === empty($db_session->id)) {
         ObjectHelper::shallowCopy($this, $db_session);
         $db_session->store();
         $this->id = $db_session->id;
         $this->_refreshSession();
     }
 }
Example #9
0
 public function initializeLevelsFrom($sourceLevels)
 {
     if (isset($sourceLevels)) {
         foreach ($sourceLevels as $sourceLevel) {
             $sourceLevelName = ObjectHelper::getPropertyValue($sourceLevel, 'name');
             $level = $this->findLevel($sourceLevelName);
             if (!isset($level)) {
                 $level = $this->registerLevel($sourceLevelName);
             }
             $level->initializeFrom($sourceLevel);
         }
     }
 }
Example #10
0
 /**
  * Sets public attributes on an object to those held in an associative array.
  * By default does not copy entries in the array that do not correspond
  * to an attribute in the object.  Also takes an optional array
  * of fields to ignore.
  *
  * @param array $array						Associative array of values
  * @param object $object					Object to copy to
  * @param boolean $ignoreMissingAttributes	If True does not copy attributes not found
  * 											in the object
  * @param array $ignoreFields				Array of fields to ignore
  */
 function bindArrayToObject($array, &$object, $ignoreMissingAttributes = true, $ignoreFields = array())
 {
     $allowedKeys = array_keys($array);
     $allowedKeys = array_diff($allowedKeys, $ignoreFields);
     if (true === $ignoreMissingAttributes) {
         $allowedKeys = array_intersect($allowedKeys, ObjectHelper::getPublicProperties($object));
     }
     if (is_array($array) && is_object($object)) {
         foreach ($allowedKeys as $key) {
             $object->{$key} = true === isset($array[$key]) ? $array[$key] : null;
         }
     }
     return true;
 }
Example #11
0
 /**
  * Sets public attributes on an object to those held in another object
  * By default does not copy entries in the array that do not correspond
  * to an attribute in the object.  Also takes an optional array
  * of fields to ignore.
  *
  * @param object $src						Object to copy from
  * @param object $dest						Object to copy to
  * @param boolean $ignoreObjectsArrays		If True objects and arrays are not copied
  * @param boolean $ignoreMissingAttributes	If True does not copy attributes not found
  * 											in the object
  * @param array $ignoreFields				Array of fields to ignore
  */
 function shallowCopy(&$src, &$dest, $ignoreObjectsArrays = true, $ignoreMissingAttributes = true, $ignoreFields = array())
 {
     $allowedKeys = ObjectHelper::getPublicProperties($src, $ignoreFields);
     if (true === $ignoreMissingAttributes) {
         $allowedKeys = array_intersect($allowedKeys, ObjectHelper::getPublicProperties($dest, $ignoreFields));
     }
     if (true === is_array($allowedKeys) && true === is_object($dest)) {
         foreach ($allowedKeys as $key) {
             $value = $src->{$key};
             if (true === is_object($value) || true === is_array($value)) {
                 if ($ignoreObjectsArrays) {
                     continue;
                 } else {
                     $dest->{$key} =& $value;
                 }
             } else {
                 $dest->{$key} = $value;
             }
         }
     }
     return true;
 }
 /**
  * @param $data
  * @return null|static
  */
 static function deserialize($data)
 {
     $result = null;
     $arr = null;
     if (is_string($data)) {
         $arr = json_decode($data, true);
     } else {
         if (is_array($data)) {
             $arr = $data;
         } else {
             if (is_object($data)) {
                 $arr = get_object_vars($data);
             }
         }
     }
     if ($arr) {
         /** @var $result DeserializeTrait */
         $result = new static();
         ObjectHelper::copyExistingProperties($arr, $result);
         $result->deserializeExtra($arr);
     }
     return $result;
 }
    public function initializeAliasesFrom($sourceAliases, $replace = FALSE) {
        if ($replace) {
            $this->aliases = NULL;
        }

        if (isset($sourceAliases)) {
            ObjectHelper::mergeWith($this->aliases, $sourceAliases, TRUE);
        }
    }
    public function initializeDimensionsFrom($sourceDimensions) {
        if (isset($sourceDimensions)) {
            foreach ($sourceDimensions as $sourceDimension) {
                $sourceDimensionName = ObjectHelper::getPropertyValue($sourceDimension, 'name');

                $dimension = $this->findDimension($sourceDimensionName);
                if (!isset($dimension)) {
                    $dimension = $this->registerDimension($sourceDimensionName);
                }
                $dimension->initializeFrom($sourceDimension);
            }
        }
    }
Example #15
0
 /**
  * gets a list of datastreams and related function that we should use to show datastreams in their own fieldsets
  * from the content model associated with the object
  */
 function createExtraFieldsets($pid, $contentModel)
 {
     //$models = $collectionHelper->getContentModels($collectionPid, false);
     // possible problem in below if the collection policy has multiple content models
     //with different pids but same dsid we could get wrong one,  low probability and functionality
     // will probably change for fedora version 3.
     if (empty($contentModel)) {
         return null;
     }
     try {
         $contentModelXMLStream = $this->getStream($contentModel, 'ISLANDORACM', false);
     } catch (Exception $e) {
     }
     if (empty($contentModelXMLStream)) {
         return null;
     }
     $count = 0;
     $output = '';
     try {
         $xml = new SimpleXMLElement($contentModelXMLStream);
     } catch (Exception $e) {
         //just show default dc or qdc as we could not find a content model
         module_load_include('php', 'Fedora_Repository', 'ObjectHelper');
         $objectHelper = new ObjectHelper();
         $metaDataText = 'Description';
         $body = $objectHelper->getQDC($pid);
         $fieldset = array('#title' => t($metaDataText), '#collapsible' => TRUE, '#collapsed' => TRUE, '#value' => $body);
         $output .= theme('fieldset', $fieldset);
         return $output;
     }
     if ($xml->display_in_fieldset->datastream != null) {
         foreach ($xml->display_in_fieldset->datastream as $datastream) {
             $count++;
             $dsId = $datastream['id'];
             $expanded = $datastream['expanded'];
             $phpFile = '';
             if (!empty($datastream->method->file)) {
                 $phpFile = strip_tags($datastream->method->file->asXML());
             }
             if (!empty($phpFile)) {
                 $phpClass = strip_tags($datastream->method->class_name->asXML());
                 $phpMethod = strip_tags($datastream->method->method_name->asXML());
                 require_once drupal_get_path('module', 'Fedora_Repository') . '/' . $phpFile;
                 $thisClass = new $phpClass($pid);
                 $output .= $thisClass->{$phpMethod}();
             }
         }
     }
     if ($count < 1) {
         //just show default dc or qdc as we could not find a content model
         $metaDataText = 'Description';
         $body = $this->getQDC($pid);
         $fieldset = array('#title' => t($metaDataText), '#collapsible' => TRUE, '#collapsed' => TRUE, '#value' => $body);
         $output .= theme('fieldset', $fieldset);
     }
     if ('ilives:pageCModel' == $contentModel || 'ilives:bookCModel' == $contentModel) {
         global $user;
         $qs = '';
         if ($user->uid != 0) {
             $qs = '?uid=' . base64_encode($user->name . ':' . $user->sid);
         }
         $viewer_url = variable_get('fedora_base_url', '') . '/get/' . $pid . '/ilives:viewerSdef/getViewer' . $qs;
         $html = '<iframe src="' . $viewer_url . '" frameborder="0" style="width: 100%; height: 400px;">Errors: unable to load viewer</iframe>';
         $fieldset = array('#title' => t('Viewer'), '#collapsible' => TRUE, '#collapsed' => $collapsed, '#value' => $html);
         return theme('fieldset', $fieldset);
     }
     return $output;
 }
Example #16
0
 public function initializeFrom($sourceReferencePointColumn)
 {
     if (isset($sourceReferencePointColumn)) {
         $this->datasetName = ObjectHelper::getPropertyValue($sourceReferencePointColumn, 'datasetName');
         $this->columnName = ObjectHelper::getPropertyValue($sourceReferencePointColumn, 'columnName');
         $this->shared = ObjectHelper::getPropertyValue($sourceReferencePointColumn, 'shared');
     }
 }
Example #17
0
 function getStream($pid, $dsid, $showError = 1)
 {
     module_load_include('php', 'Fedora_Repository', 'ObjectHelper');
     $objectHelper = new ObjectHelper();
     return $objectHelper->getStream($pid, $dsid, $showError);
 }
    public function execute() {
        $output = curl_exec($this->handler->ch);
        $isOutputRequired = isset($this->handler->outputFormatter);

        $error = curl_error($this->handler->ch);
        if ($error != '') {
            $this->errorResourceExecution($this->handler->resourceId, $error);
        }

        // storing some information about the execution into log
        $preparedExecutionInfo = NULL;
        ObjectHelper::copySelectedProperties(
            $preparedExecutionInfo, curl_getinfo($this->handler->ch),
            array(
                'url', 'content_type', 'redirect_url', 'http_code', 'redirect_count',
                'namelookup_time', 'connect_time', 'pretransfer_time', 'starttransfer_time', 'redirect_time', 'total_time',
                'size_upload', 'upload_content_length', 'speed_upload',
                'speed_download', 'download_content_length'));
        LogHelper::log_debug($preparedExecutionInfo);

        if ($isOutputRequired) {
            try {
                $output = $this->handler->outputFormatter->format($this->handler->resourceId, $output);
            }
            catch (Exception $e) {
                LogHelper::log_debug(new PreservedTextMessage($output));
                throw $e;
            }
        }

        if ($preparedExecutionInfo->http_code != 200) {
            // only if formatting completed successfully we will reach this point
            $this->errorResourceExecution($this->handler->resourceId, $preparedExecutionInfo->http_code);
        }

        return $isOutputRequired ? $output : NULL;
    }
 protected function getColumnValue($record, $columnName) {
     return ObjectHelper::getPropertyValue($record, $columnName);
 }
Example #20
0
 /**
  * Serialize a room to JSON
  *
  * @param Room_delegate $room
  * @return RoomVO
  */
 private function _serializeRoom(&$room)
 {
     $this->load->helper('badge');
     $public_dir = Badge_helper::getPublicDirectoryPath();
     $room_vo = new RoomVO();
     ObjectHelper::shallowCopy($room, $room_vo);
     $question =& $this->current_room->getQuestion();
     if (false === empty($question)) {
         $question_vo = new QuestionVO();
         ObjectHelper::shallowCopy($question, $question_vo);
         $question_vo->completed = in_array($question->id, $this->gamesession->getCompletedQuestions());
         $responses =& $this->current_room->getResponses();
         foreach ($responses as $response) {
             $response_vo = new ResponseVO();
             ObjectHelper::shallowCopy($response, $response_vo);
             $filename = $public_dir . DIRECTORY_SEPARATOR . $response_vo->image;
             /**
              * Get image sizes to avoid issues in IE6
              */
             if (true === file_exists($filename)) {
                 $sizes = getimagesize($filename);
                 $response_vo->width = $sizes[0];
                 $response_vo->height = $sizes[1];
             }
             $response_vo->image = site_url($response_vo->image);
             $response_vo->image_hover = site_url($response_vo->image_hover);
             $question_vo->responses[] = $response_vo;
         }
         $room_vo->question = $question_vo;
     }
     $room_vo->image = site_url($room_vo->image);
     $room_vo->map_image = site_url($room_vo->map_image);
     foreach ($room_vo->navigation as $direction => $value) {
         $navigation_allowed = new AllowedNavigationVO();
         $navigation_allowed->allowed = $this->_isDirectionAllowed($this->gamesession->getCurrentOrientation(), $direction, &$room);
         if (true == $navigation_allowed->allowed) {
             switch ($direction) {
                 case 'left':
                 case 'right':
                     $navigation_allowed->message = 'Turn ' . $this->_getOrientationFromDirection($direction, $this->gamesession->getCurrentOrientation());
                     break;
                 case 'forward':
                     $navigation_allowed->message = 'Proceed ' . $this->_getOrientationFromDirection($direction, $this->gamesession->getCurrentOrientation());
                     break;
                 case 'back':
                     $navigation_allowed->message = 'Backtrack';
                     break;
             }
         }
         $room_vo->navigation[$direction] = $navigation_allowed;
         //$this->_isDirectionAllowed($this->gamesession->getCurrentOrientation(), $direction, &$room);
     }
     return $room_vo;
 }
    public static function search(array $array = NULL, $propertyName, $needle) {
        if (isset($array)) {
            foreach ($array as $key => $item) {
                $v = ObjectHelper::getPropertyValue($item, $propertyName);
                if ($v == $needle) {
                    return $key;
                }
            }
        }

        return NULL;
    }
 function showCritter()
 {
     $dsid = 'CRITTER';
     $path = drupal_get_path('module', 'Fedora_Repository');
     require_once drupal_get_path('module', 'Fedora_Repository') . '/ObjectHelper.php';
     require_once drupal_get_path('module', 'Fedora_Repository') . '/CollectionClass.php';
     $objectHelper = new ObjectHelper();
     $collectionHelper = new CollectionClass();
     $xmlstr = $collectionHelper->getStream($this->pid, "CRITTER");
     html_entity_decode($xmlstr);
     if ($xmlstr == null || strlen($xmlstr) < 5) {
         return " ";
     }
     try {
         $proc = new XsltProcessor();
     } catch (Exception $e) {
         drupal_set_message(t($e->getMessage()), 'error');
         return " ";
     }
     $xsl = new DomDocument();
     $xsl->load($path . '/mnpl/xsl/critter.xsl');
     $input = new DomDocument();
     $input->loadXML(trim($xmlstr));
     $xsl = $proc->importStylesheet($xsl);
     $newdom = $proc->transformToDoc($input);
     $content = $newdom->saveXML();
     $pid = $this->pid;
     session_start();
     $_SESSION['pid'] = $pid;
     // set labid as session variable to build identifier in add fraction, etc
     $cxl = new SimpleXMLElement($xmlstr);
     $labid = implode($cxl->xpath('//critters:lab_id'));
     $_SESSION['labid'] = $labid;
     $itqlQuery = 'select $object $title  from <#ri> where $object <fedora-model:label> $title  and $object <fedora-rels-ext:isPartOf> <info:fedora/' . $pid . '> and $object <fedora-model:state> <info:fedora/fedora-system:def/model#Active> order by $title';
     $relatedItems = $collectionHelper->getRelatedItems($this->pid, $itqlQuery);
     $sxe = new SimpleXMLElement($relatedItems);
     $nmspace = $sxe->getNamespaces(true);
     $regspace = $sxe->registerXPathNamespace('ri', implode($nmspace));
     // begin fractions
     global $base_url;
     if (user_access('edit fedora meta data')) {
         $editspec = '<a href =' . $base_url . '/fedora/repository/editmetadata/' . $pid . '/' . $dsid . '>Edit This Specimen</a><br>';
     } else {
         $editspec = '';
     }
     if (user_access('ingest new fedora objects')) {
         $flabel = '<h4>Fractions &mdash; <a href="' . $base_url . '/fedora/ingestObject/vre:mnpl-fractions/MNPL%20Fraction%20Collection/mnpl-fractionCModel">Add Fraction</a></h4>';
     } else {
         $flabel = '<h4>Fractions</h4>';
     }
     if (stristr(implode($sxe->xpath('//ri:title')), 'fraction')) {
         $fraction .= '<table width="100%" cellpadding="2"><tr><td>Identifier</td><td>Weight</td><td>PTP1B</td><td>HCT116</td><td>HELA</td><td>PC3</td><td>ARE</td><td>Antiproliferative</td></tr>';
         foreach ($sxe->xpath('//@uri') as $link) {
             if (strstr($link, 'fraction')) {
                 $link = substr($link, 12);
                 $fraction .= '<tr>';
                 $fraction .= '<td><a href = "' . $base_url . '/fedora/repository/' . $link . '">' . substr($link, 18) . '</a></td>';
                 $fraction .= $this->show_fraction_details($link);
                 $fraction .= '</tr>';
             }
         }
         $fraction .= '</table>';
     } else {
         $fraction = "<div>No Fractions present for this Specimen</div>";
     }
     // return compounds
     $clabel = '<br /><h4>Compounds';
     if (user_access('ingest new fedora objects')) {
         $clabel .= ' &mdash; <a href="' . $base_url . '/fedora/ingestObject/vre:mnpl-compounds">Add Compound</a></h4>';
     }
     if (stristr(implode($sxe->xpath('//ri:title')), 'compound')) {
         // if(in_array('COMPOUND',$sxe->xpath('//ri:contentmod'))){
         $compound .= '<table width="100%" cellpadding="2"><tr><td>Identifier</td><td>Weight</td><td>PTP1B</td><td>HCT116</td><td>HELA</td><td>PC3</td><td>ARE</td><td>Antiproliferative</td></tr>';
         foreach ($sxe->xpath('//@uri') as $link) {
             if (strstr($link, 'compound')) {
                 $link = substr($link, 12);
                 $compound .= '<tr>';
                 $compound .= '<td><a href = "' . $base_url . '/fedora/repository/' . $link . '">' . substr($link, 18) . '</a></td>';
                 $compound .= $this->show_compound_details($link);
                 $compound .= '</tr>';
             }
         }
         $compound .= '</table>';
     } else {
         $compound = "<div>No Compounds present for this Specimen</div>";
     }
     $datastream_list = $objectHelper->get_datastreams_list_asSimpleXML($this->pid);
     $thumbs = '<div><p>';
     $thumbs .= '<a href="' . $base_url . '/fedora/repository/' . $pid . '/OBJ" target="_blank"><img src="' . $base_url . '/fedora/imageapi/' . $pid . '/OBJ?op=scale&height=100" /></a>&nbsp;';
     foreach ($datastream_list as $datastream) {
         foreach ($datastream as $datastreamValue) {
             $test = substr($datastreamValue->ID, 0, 5);
             if ($test == 'IMAGE') {
                 $thumbs .= '<a href="' . $base_url . '/fedora/repository/' . $pid . '/' . $datastreamValue->ID . '" target="_blank"><img src="' . $base_url . '/fedora/imageapi/' . $pid . '/' . $datastreamValue->ID . '?op=scale&height=100" /></a>&nbsp;';
             }
         }
     }
     $thumbs .= '</p></div><br />';
     $collection_fieldset = array('#title' => t('MNPL Critter Record'), '#collapsible' => TRUE, '#collapsed' => FALSE, '#value' => $thumbs . $content . $editspec . $flabel . $fraction . $clabel . $compound);
     return theme('fieldset', $collection_fieldset);
 }
Example #23
0
    <h2>Questions</h2>
<?php 
    $questions = $this->all_levels->getQuestions($level->id);
    foreach ($questions as $question) {
        ?>
	<div class="question">
    	<?php 
        echo ObjectHelper::dumpPublicProperties($question, array('id', 'action_function', 'target_image', 'target_pos_x', 'target_pos_y', 'target_height', 'target_width'));
        ?>
  		
        <h3>Responses</h3>  
<?php 
        $responses = $this->all_levels->getResponses($question->id);
        foreach ($responses as $response) {
            ?>
 
			<div class="response">
            	<?php 
            echo ObjectHelper::dumpPublicProperties($response, array('id', 'question_id', 'more_information', 'image_pos_x', 'image_pos_y'));
            ?>
            </div>
<?php 
        }
        ?>
    </div>
<?php 
    }
    ?>
</div>
<?php 
}
Example #24
0
 public function initializeColumnFrom($sourceColumn)
 {
     $sourceColumnName = ObjectHelper::getPropertyValue($sourceColumn, 'name');
     $column = $this->findColumn($sourceColumnName);
     $isColumnNew = !isset($column);
     if ($isColumnNew) {
         $column = $this->initiateColumn();
         $sourceColumnIndex = ObjectHelper::getPropertyValue($sourceColumn, 'columnIndex');
         if (!isset($sourceColumnIndex)) {
             // we do not check for last column index here and that is correct
             // we just assign index based on column count
             $column->columnIndex = count($this->columns);
         }
     }
     $column->initializeFrom($sourceColumn);
     if ($isColumnNew) {
         $this->registerColumnInstance($column);
     }
     return $column;
 }
Example #25
0
 /**
  * Returns a list of columns, one for each public attribute of the delegate
  *
  * @access protected
  * @return array	List of columns
  */
 function _getColumns()
 {
     return ObjectHelper::getPublicProperties($this);
 }
Example #26
0
 private function _refreshSession()
 {
     $ci =& get_instance();
     $ci->session->set_userdata(MEMBER_SESSION_KEY, ObjectHelper::toArray($this, false));
 }
Example #27
0
 public function initializeTypeFrom($sourceType)
 {
     if (isset($sourceType)) {
         ObjectHelper::mergeWith($this->type, $sourceType, TRUE);
     }
 }
Example #28
0
 public function initializeInstanceFrom($source)
 {
     ObjectHelper::mergeWith($this, $source);
 }
Example #29
0
 function buildFractionEditForm()
 {
     module_load_include('php', 'Fedora_Repository', 'ObjectHelper');
     $object = new ObjectHelper();
     $frac = $object->getStream($this->pid, 'FRACTION', 0);
     $doc = new DomDocument();
     if (!isset($frac)) {
         drupal_set_message(t('Error getting fraction metadata stream'), 'error');
         return null;
     }
     $xml = new SimpleXMLElement($frac);
     $radioValues = array();
     $radioValues['No_Assay'] = 'No_Assay';
     $radioValues['Hit'] = 'Hit';
     $radioValues['Strong'] = 'Strong';
     $radioValues['Medium'] = 'Medium';
     $radioValues['Low'] = 'Low';
     $radioValues['Inactive'] = 'Inactive';
     $form = array();
     $identifier = $xml->xpath('//fractions:identifier');
     $form['identifier'] = array('#type' => 'hidden', '#title' => t('<strong>Identifier</strong>'), '#value' => implode($identifier));
     $form['ident'] = array('#type' => 'item', '#title' => t('<strong>Identifier</strong>'), '#value' => implode($identifier));
     $plate = $xml->xpath('//fractions:plate');
     $form['plate'] = array('#type' => 'textfield', '#default_value' => implode($plate), '#title' => t('<strong>Plate</strong>'));
     $weight = $xml->xpath('//fractions:weight');
     $form['weight'] = array('#type' => 'textfield', '#default_value' => implode($weight), '#title' => t('<strong>Weight</strong>'));
     $pt = $xml->xpath('//fractions:ptp1b');
     $form['pt'] = array('#type' => 'radios', '#default_value' => implode($pt), '#options' => $radioValues, '#title' => t('<strong>PTP1B</strong>'));
     $pt_com = $xml->xpath('//fractions:ptp1b_com');
     $form['pt_com'] = array('#type' => 'textfield', '#default_value' => implode($pt_com), '#title' => t('<strong>PTP1B Comments</strong>'));
     $hct = $xml->xpath('//fractions:hct116');
     $form['hct'] = array('#type' => 'radios', '#default_value' => implode($hct), '#options' => $radioValues, '#title' => t('<strong>HCT116</strong>'));
     $hct_com = $xml->xpath('//fractions:hct116_com');
     $form['hct_com'] = array('#type' => 'textfield', '#default_value' => implode($hct_com), '#title' => t('<strong>HCT116 Comments</strong>'));
     $hela = $xml->xpath('//fractions:hela');
     $form['hela'] = array('#type' => 'radios', '#default_value' => implode($hela), '#options' => $radioValues, '#title' => t('<strong>HELA</strong>'));
     $hela_com = $xml->xpath('//fractions:hela_com');
     $form['hela_com'] = array('#type' => 'textfield', '#default_value' => implode($hela_com), '#title' => t('<strong>HELA Comments</strong>'));
     $pc3 = $xml->xpath('//fractions:pc3');
     $form['pc3'] = array('#type' => 'radios', '#default_value' => implode($pc3), '#options' => $radioValues, '#title' => t('<strong>PC3</strong>'));
     $pc3_com = $xml->xpath('//fractions:pc3_com');
     $form['pc3_com'] = array('#type' => 'textfield', '#default_value' => implode($pc3_com), '#title' => t('<strong>PC3 Comments</strong>'));
     $are = $xml->xpath('//fractions:are');
     $form['are'] = array('#type' => 'radios', '#default_value' => implode($are), '#options' => $radioValues, '#title' => t('<strong>ARE</strong>'));
     $are_com = $xml->xpath('//fractions:are_com');
     $form['are_com'] = array('#type' => 'textfield', '#default_value' => implode($are_com), '#title' => t('<strong>ARE Comments</strong>'));
     $antiproliferative = $xml->xpath('//fractions:antiproliferative');
     $form['antiproliferative'] = array('#type' => 'radios', '#default_value' => implode($antiproliferative), '#options' => $radioValues, '#title' => t('<strong>Antiproliferative</strong>'));
     $antiproliferative_com = $xml->xpath('//fractions:antiproliferative_com');
     $form['antiproliferative_com'] = array('#type' => 'textfield', '#default_value' => implode($antiproliferative_com), '#title' => t('<strong>Antiproliferative Comments</strong>'));
     $location = $xml->xpath('//fractions:location');
     $form['location'] = array('#type' => 'textfield', '#default_value' => implode($location), '#title' => t('<strong>Location</strong>'));
     $notes = $xml->xpath('//fractions:notes');
     $form['notes'] = array('#type' => 'textarea', '#default_value' => implode($notes), '#title' => t('<strong>Notes</strong>'));
     $form['#redirect'] = 'fedora/repository/' . $this->pid;
     $form['pid'] = array('#type' => 'hidden', '#value' => $this->pid);
     $form['dsid'] = array('#type' => 'hidden', '#value' => 'FRACTION');
     $form['submit'] = array('#type' => 'submit', '#value' => 'Update');
     return $form;
 }
 public function initializeInstanceFrom($sourceDataSource) {
     // we need to support some unknown composite properties
     ObjectHelper::mergeWith($this, $sourceDataSource, TRUE);
 }