function quality_report($id, $status_filter = null)
 {
     //$data['report'] = $this->getDataSourceReport($id);
     $data['title'] = 'Data Source Report';
     $data['scripts'] = array();
     $data['less'] = array('charts');
     $data['js_lib'] = array('core');
     $this->load->model("data_source/data_sources", "ds");
     $this->load->model("registry_object/registry_objects", "ro");
     if ($status_filter) {
         $data['filter'] = "Quality report for " . readable($status_filter);
     }
     $report = array();
     $data['ds'] = $this->ds->getByID($id);
     $ids = $this->ro->getIDsByDataSourceID($id, false, 'All');
     acl_enforce('REGISTRY_USER');
     ds_acl_enforce((int) $id);
     if ($ids) {
         $data['record_count'] = sizeof($ids);
         $problems = 0;
         $replacements = array("recommended" => "<u>recommended</u>", "required" => "<u>required</u>", "must be" => "<u>must be</u>");
         foreach ($ids as $idx => $ro_id) {
             try {
                 $ro = $this->ro->getByID($ro_id);
                 if (!$status_filter || $ro->status == $status_filter) {
                     $report_html = $ro ? str_replace(array_keys($replacements), array_values($replacements), $ro->getMetadata('quality_html')) : '';
                     $report[$ro_id] = array('quality_level' => $ro->quality_level == 4 ? 'Gold Standard' : $ro->quality_level, 'class' => $ro->class, 'title' => $ro->title, 'status' => readable($ro->status), 'id' => $ro->id, 'report' => $report_html);
                 }
             } catch (Exception $e) {
                 throw new Exception($e);
             }
             unset($ro);
             clean_cycles();
         }
     }
     uasort($report, array($this, 'cmpByQualityLevel'));
     $data['report'] = $report;
     $this->load->view('detailed_quality_report', $data);
 }
 public function getDataSourceQualityChart($data_source_id, $status = 'ALL', $as_csv = false)
 {
     $chart_result = array();
     $constraints = array($data_source_id);
     if ($status != 'ALL') {
         $constraints[] = $status;
     }
     $query = $this->db->query("SELECT count(*) AS count, `value`, `class`\n\t\t\t\t\t\t\tFROM registry_objects ro \n\t\t\t\t\t\t\tJOIN registry_object_attributes ra ON ra.registry_object_id = ro.registry_object_id \n\t\t\t\t\t\t\tWHERE data_source_id=? AND ra.attribute = 'quality_level' " . ($status != 'ALL' ? "AND ro.status = ? " : '') . "\n\t\t\t\t\t\t\tGROUP BY `value`, `class`;", $constraints);
     $this->load->model("registry_object/registry_objects");
     $chart_result['All Records'] = array();
     foreach (Registry_objects::$classes as $c => $c_label) {
         $chart_result[$c_label] = array();
         foreach (Registry_objects::$quality_levels as $q => $q_label) {
             if (!isset($chart_result['All'][$q_label])) {
                 $chart_result['All Records'][$q_label] = 0;
             }
             if ($q_label == "Gold Standard Record") {
                 $gs_query = $this->db->query("SELECT count(*) AS count\n\t\t\t\t\t\t\tFROM registry_objects ro \n\t\t\t\t\t\t\tJOIN registry_object_attributes ra ON ra.registry_object_id = ro.registry_object_id \n\t\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\tclass = ? \n\t\t\t\t\t\t\tAND data_source_id=? \n\t\t\t\t\t\t\tAND ra.attribute = 'gold_status_flag' \n\t\t\t\t\t\t\tAND ra.value = 't' " . ($status != 'ALL' ? "AND ro.status = ? " : '') . ";", array_merge(array($c), $constraints));
                 $gs_query = array_pop($gs_query->result_array());
                 $chart_result[$c_label][$q_label] = (int) $gs_query['count'];
                 $chart_result['All Records'][$q_label] = $chart_result['All Records'][$q_label] + (int) $gs_query['count'];
             } else {
                 $chart_result[$c_label][$q_label] = 0;
             }
         }
     }
     foreach ($query->result() as $row) {
         if (isset($chart_result[Registry_objects::$classes[$row->class]]) && isset(Registry_objects::$quality_levels[$row->value])) {
             $chart_result[Registry_objects::$classes[$row->class]][Registry_objects::$quality_levels[$row->value]] = (int) $row->count;
             $chart_result['All Records'][Registry_objects::$quality_levels[$row->value]] = $chart_result['All Records'][Registry_objects::$quality_levels[$row->value]] + (int) $row->count;
         }
     }
     // Default, deliver as JSON
     if (!$as_csv) {
         echo json_encode($chart_result);
     } else {
         $header_row = array("");
         foreach (Registry_objects::$quality_levels as $q => $q_label) {
             array_push($header_row, $q_label);
         }
         $rows = array(array(readable($status) . " Records"), $header_row);
         foreach ($chart_result as $class => $results) {
             array_unshift($results, $class);
             $rows[] = $results;
         }
         // We'll be outputting a CSV
         header('Content-type: application/ms-excel');
         header('Content-Disposition: attachment; filename="datasource_quality_' . $data_source_id . '.xls"');
         $data = array_merge($rows);
         echo array_to_TABCSV($data);
     }
 }
                        @endforeach
                        @if($ro->relationships['service_count'] > $relatedLimit)
                            <a href="{{$relatedSearchQuery}}/class=service">View all {{$ro->relationships['service_count']}} related services</a>
                        @endif
                    </p>
                    @endif

                    @if($hasRelatedWebsite)
                    <h4>Related Websites</h4>
                    @foreach($ro->relatedInfo as $relatedInfo)
                        @if($relatedInfo['type']=='website')
                    <?php 
$description = '';
$relationship = '';
if (isset($relatedInfo['relation']['relation_type']) && $relatedInfo['relation']['relation_type'] != '') {
    $relationship = readable($relatedInfo['relation']['relation_type']);
}
if (isset($relatedInfo['relation']['description']) && $relatedInfo['relation']['description'] != '') {
    $description .= 'tip="' . $relatedInfo['relation']['description'] . '"';
} elseif (isset($relatedInfo['identifier']['identifier_href']['hover_text']) && $relatedInfo['identifier']['identifier_href']['hover_text'] != '') {
    $description = 'tip="' . $relatedInfo['identifier']['identifier_href']['hover_text'] . '"';
} elseif (isset($relatedInfo['identifier']['identifier_value']) && $relatedInfo['identifier']['identifier_value'] != '') {
    $description = 'tip="' . $relatedInfo['identifier']['identifier_value'] . '"';
} else {
    $description = 'tip="' . $relatedInfo['title'] . '"';
}
?>
                            @if($relatedInfo['title'])
                            <i class="fa fa-globe icon-portal""></i>  <small>{{$relationship}} </small> {{$relatedInfo['title']}}
                                <p>
                                    @if($relatedInfo['identifier']['identifier_href']['display_text'])
Exemple #4
0
    $ri = new ReleaseImage();
    $folders[$ri->audSavePath] = [R, W];
    $folders[$ri->imgSavePath] = [R, W];
    $folders[$ri->jpgSavePath] = [R, W];
    $folders[$ri->movieImgSavePath] = [R, W];
    $folders[$ri->vidSavePath] = [R, W];
} else {
    echo 'Skipping cover folders check, as you have not set up a database yet. You can rerun this script after running install.' . PHP_EOL;
}
// Check folders.
foreach ($folders as $folder => $check) {
    exists($folder);
    foreach ($check as $type) {
        switch ($type) {
            case R:
                readable($folder);
                break;
            case W:
                writable($folder);
                break;
            case E:
                executable($folder);
                break;
        }
    }
}
echo 'Your permissions seem right for this user. Note, this script does not verify all paths, only the most important ones.' . PHP_EOL;
if (!nzedb\utility\Misc::isWin()) {
    $user = posix_getpwuid(posix_geteuid());
    if ($user['name'] !== 'www-data') {
        echo 'If you have not already done so, please rerun this script using the www-data user: sudo -u www-data php verify_permissions.php yes' . PHP_EOL;
            if (isset($right['accessRights_type'])) {
                $ar = $right['accessRights_type'];
            }
            $detail = true;
        } else {
            $detail = true;
        }
    }
    if ($detail) {
        $content = '';
        foreach ($ro->rights as $right) {
            $itemprop = '';
            if ($right['type'] == 'licence') {
                $itemprop = 'itemprop="license"';
            }
            $content .= '<h4>' . readable($right['type']) . '</h4>';
            $content .= '<p ' . $itemprop . '>' . $right['value'] . '</p>';
        }
    }
}
?>
<div class="panel panel-primary swatch-white">
    <div class="panel-body">
        <div class="center-block" style="text-align:center">
            <div ng-if="ro.stat">
                <span style="padding-right:4px;" tip="This page has been viewed [[ro.stat.viewed]] times.<br/><span style='font-size:0.8em'>Statistics collected since April 2015</span>"><small>Viewed: </small>[[ro.stat.viewed]]</span>
               <!-- <a href="#" style="padding-right:4px;"><small>Accessed: </small>[[ro.stat.accessed]]</a> -->
            </div>
        </div>
        
    	<div class="btn-group btn-group-justified element element-short-bottom element-short-top" role="group" aria-label="...">
Exemple #6
0
 /**
  * List All Roles that fit in a role_type_id in JSON form
  * @param  string $role_type_id
  * @return json                
  */
 public function list_roles($role_type_id = false)
 {
     if (!$role_type_id) {
         $role_type_id = false;
     }
     $roles = array();
     foreach ($this->roles->list_roles($role_type_id) as $role) {
         $role = array('role_id' => rawurlencode($role->role_id), 'name' => $role->name, 'type' => readable($role->role_type_id), 'enabled' => readable($role->enabled), 'last_modified' => $role->modified_when, 'auth_service' => $role->authentication_service_id);
         array_push($roles, $role);
     }
     echo json_encode($roles);
 }
?>
</label>
						<label class="checkbox"><input type="checkbox" name="ro_status" value="DRAFT" checked="checked" /><?php 
echo readable('DRAFT');
?>
</label>
						<label class="checkbox"><input type="checkbox" name="ro_status" value="SUBMITTED_FOR_ASSESSMENT" checked="checked" /><?php 
echo readable('SUBMITTED_FOR_ASSESSMENT');
?>
</label>
						<label class="checkbox"><input type="checkbox" name="ro_status" value="MORE_WORK_REQUIRED" checked="checked" /><?php 
echo readable('MORE_WORK_REQUIRED');
?>
</label>
                        <label class="checkbox"><input type="checkbox" name="ro_status" value="ASSESSMENT_IN_PROGRESS" checked="checked"/><?php 
echo readable('assessment_in_progress');
?>
</label>
	                    <hr/>
                        <label><b>Export As:</b></label>
                        <label class="checkbox"><input type="radio" name="format" checked="checked" value="rif-cs"/> RIF-CS</label>
                        <label class="checkbox"><input type="radio" name="format" value="dci"/> DCI</label>
                    </fieldset>
				</form>
			</div>
		</div>
		<div class="modal-footer">
			<a href="javascript:;" class="btn btn-primary" ng-click="export('file')"><i class="icon icon-white icon-download"></i> Download As File</a>
			<a href="javascript:;" class="btn btn-link" ng-click="export('xml')">View Records in Browser</a>
			<a href="#" class="btn hide" data-dismiss="modal">Close</a>
		</div>
Exemple #8
0
/**
 * 创建并返回一个临时文件路径
 * @param string $prefix 文件名前缀
 * @param string $dir 指定根目录
 * @return boolean
 */
function tmp($prefix = 'tmp', $dir = null)
{
    if (!is_dir($dir)) {
        $dir = sys_get_temp_dir();
    }
    $filename = tempnam($dir, $prefix);
    if (!$filename) {
        return error('cannot create template file');
    }
    if (!readable($filename)) {
        return false;
    }
    return realpath($filename);
}
 /**
  * check an ro_key to see uniqueness
  * @param  string ro_key
  * @return [results]
  */
 public function check_unique_ro_key()
 {
     $results = array();
     $this->load->database();
     $key = $this->input->get('ro_key');
     $results['ro_key'] = $key;
     // $query = $this->db->select('*')->get_where('registry_objects', array("binary key"=>$key), true);
     //case sensitive search for key
     $query = $this->db->where('binary `key` =', '"' . $key . '"', false)->get('registry_objects');
     $results['ro_list'] = $query->result_array();
     if (is_array($results['ro_list']) && count($results['ro_list'] > 0)) {
         foreach ($results['ro_list'] as &$item) {
             $item['status'] = readable($item['status'], true);
         }
     }
     $results = json_encode($results);
     echo $results;
 }
@if($ro->relatedInfo)
    @foreach($ro->relatedInfo as $relatedInfo)
        @if($relatedInfo['type']=='party')

            @if(isset($relatedInfo['identifier']['identifier_href']['href']))
                <?php 
$outstr = '<a href="' . $relatedInfo['identifier']['identifier_href']['href'] . '">' . $relatedInfo['title'] . ' </a>';
?>
            @else
                <?php 
$outstr = $relatedInfo['title'];
?>
            @endif
            @if(isset($relatedInfo['relation']['relation_type']))
               <?php 
$type = readable($relatedInfo['relation']['relation_type'], 'EXPLICIT', $ro->core['class']);
?>
            @else
                <?php 
$type = '';
?>
    @endif

    <?php 
if (isset($sortedArray[$type])) {
    $sortedArray[$type][] = $outstr;
} else {
    $sortedArray[$type] = array();
    $sortedArray[$type][] = $outstr;
}
?>
        echo registry_url('assets/img/party.png');
        ?>
">
					
					<div class="pull-left" style="line-height:10px;">
					<small>
							<?php 
        echo ellipsis($record->title, 55);
        ?>
							<small class="clearfix muted">Updated <?php 
        echo timeAgo($record->updated);
        ?>
</small>
					</small>
					</div>
					<span class="tag pull-right status_<?php 
        echo $record->status;
        ?>
"><?php 
        echo readable($record->status, true);
        ?>
</span>								</a>
				<br class="clear"/>
		<?php 
    }
} else {
    echo '<i>No records have been updated in the past 7 days.</i>';
}
?>
</div>
								<td><?php 
echo readable($role->role_type_id);
?>
</td>
							</tr>
							<tr>
								<th>Authentication Service</th>
								<td><?php 
echo readable($role->authentication_service_id);
?>
</td>
							</tr>
							<tr>
								<th>Enabled</th>
								<td><?php 
echo readable($role->enabled);
?>
</td>
							</tr>
							<tr>
								<th>Last Login</th>
								<td><?php 
echo $role->last_login;
?>
</td>
							</tr>
							<tr>
								<th>Created When</th>
								<td><?php 
echo $role->created_when;
?>
?>
 </div>
    <div id="minTime"   class="hidden"> <?php 
echo $minTime;
?>
 </div>

     <?php 
#### Diagnostics ####
if ($_CONFIG->trial_diagnostics == true or $trialFail == true) {
    // clean the arrays used so that they output strings, not code
    $clean_session = arrayCleaner($_SESSION);
    $clean_currentTrial = arrayCleaner($currentTrial);
    echo '<div class=diagnostics>' . '<h2>Diagnostic information</h2>' . '<ul>' . '<li> Condition #: ' . $clean_session['Condition']['Number'] . '</li>' . '<li> Condition Stimuli File:' . $clean_session['Condition']['Stimuli'] . '</li>' . '<li> Condition Procedure File: ' . $clean_session['Condition']['Procedure'] . '</li>' . '<li> Condition description: ' . $clean_session['Condition']['Condition Description'] . '</li>' . '</ul>' . '<ul>' . '<li> Trial Number: ' . $currentPos . '</li>' . '<li> Trial Type: ' . $trialType . '</li>' . '<li> Trial max time: ' . $clean_currentTrial['Procedure']['Max Time'] . '</li>' . '<li> Trial Time (seconds): ' . $maxTime . '</li>' . '</ul>' . '<ul>' . '<li> Cue: ' . show($cue) . '</li>' . '<li> Answer: ' . show($answer) . '</li>' . '</ul>';
    readable($currentTrial, "Information loaded about the current trial");
    readable($_SESSION['Trials'], "Information loaded about the entire experiment");
    echo '</div>';
}
?>

<!-- Pre-Cache Next trial -->
<div class="precachenext">
    <?php 
if ($nextTrial) {
    $nextCues = explode('|', $nextTrial['Stimuli']['Cue']);
    $nextAnswers = explode('|', $nextTrial['Stimuli']['Answer']);
    $allNext = array_merge($nextCues, $nextAnswers);
    foreach ($allNext as $next) {
        echo show($next);
    }
}
 public function getConnections($ro_id, $limit = null)
 {
     $connections = array();
     $status = array();
     if ($limit && (int) $limit > 0) {
         $party_conn_limit = $limit;
     } else {
         $party_conn_limit = 20;
     }
     $this->load->model('registry_object/registry_objects', 'ro');
     $ro = $this->ro->getByID($ro_id);
     if ($ro) {
         //$connections = $ro->getConnections();
         if ($ro->class == 'party') {
             $connections = $ro->getAllRelatedObjects(true, false, false, $party_conn_limit);
         } else {
             $connections = $ro->getAllRelatedObjects(true);
         }
         foreach ($connections as &$link) {
             // Reverse the relationship description (note: this reverses to the "readable" version (i.e. not camelcase))
             if ($link['registry_object_id'] && in_array($link['origin'], array('REVERSE_EXT', 'REVERSE_INT'))) {
                 $link['relation_type'] = format_relationship($link['class'], $link['relation_type'], $link['origin'], $ro->class);
             }
             if ($link['status']) {
                 $link['readable_status'] = readable($link['status']);
             }
         }
     }
     $status['count'] = sizeof($connections);
     echo json_encode(array("status" => $status, "connections" => $connections));
 }
    /**
     * Prints a list of the configuration settings read from <i>php.ini</i>
     *
     * @access public
     * @static
     */
    public static function phpini()
    {
        // disabled ?
        //
        if (!krumo::_debug()) {
            return false;
        }
        if (!readable(get_cfg_var('cfg_file_path'))) {
            return false;
        }
        // render it
        //
        ?>
<div class="krumo-title">
This is a list of the configuration settings read from <code><b><?php 
        echo get_cfg_var('cfg_file_path');
        ?>
</b></code>.
</div>
    <?php 
        return krumo::dump(parse_ini_file(get_cfg_var('cfg_file_path'), true));
    }
<div class="swatch-white">
	<div class="panel panel-primary element-no-top element-short-bottom panel-content">
		<!-- <div class="panel-heading"> Descriptions </div> -->
		<div class="panel-body swatch-white">
            @if($ro->core['type']=='grant')
            <h2>Research Grant</h2>
            @endif
            @if($ro->core['type']=='project')
            <h2>Research Project</h2>
            @endif

			@foreach($order as $o)
				@foreach($ro->descriptions as $desc)
					@if($desc['type']==$o)
                        <?php 
$type = readable($desc['type']);
if ($desc['type'] == 'Researchers') {
    $researchersfound = 'yes';
}
if (($o == 'fundingAmount' || $o == 'fundingScheme' || $o == 'brief' || ($o = 'full')) && $researchersfound == 'no') {
    if ($ro->relationships) {
        if (isset($ro->relationships['party_one'])) {
            $researchersfound = 'yes';
        }
    }
    if ($ro->relatedInfo) {
        foreach ($ro->relatedInfo as $relatedInfo) {
            if ($relatedInfo['type'] == 'party') {
                $researchersfound = 'yes';
            }
        }
        echo '	  </ul>
									</div>';
    }
    ?>
					</div>
					<div class="widget-content">

						<table class="table table-bordered table-striped table-small">
							<tr><th>Title</th><td><?php 
    echo $ro->title;
    ?>
</td></tr>
							
							<?php 
    if (!($viewing_revision && !$currentRevision)) {
        echo "<tr><th>Status</th><td><strong>" . readable($ro->status, true) . "</strong></td></tr>";
    } else {
        echo "<tr><th>Status</th><td style='background-color:#FF6633; color:white;'><b>SUPERSEDED</b></td></tr>";
    }
    ?>
							<tr><th>Data Source</th><td><?php 
    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')) {
        ?>
        }
        if (isset($right['rightsUri'])) {
            if ($right['rightsUri'] != '') {
                $detail = true;
            }
        }
    }
    if ($detail) {
        $content = '';
        foreach ($ro->rights as $right) {
            $itemprop = '';
            if ($right['type'] == 'licence') {
                $itemprop = 'itemprop="license"';
            }
            if (isset($right['value']) && trim($right['value']) != '' || isset($right['rightsUri']) && $right['rightsUri'] != '') {
                $content .= '<h4>' . readable($right['type']) . '</h4><p ' . $itemprop . '>';
            }
            if (isset($right['value']) && trim($right['value']) != '') {
                $content .= $right['value'] . '<br />';
            }
            if (isset($right['rightsUri']) && $right['rightsUri'] != '') {
                $content .= '<a href="' . $right['rightsUri'] . '">' . $right['rightsUri'] . '</a><br />';
            }
            $content .= '</p>';
        }
    }
}
?>

<div class="panel panel-primary swatch-white gray-bg">
    <div class="panel-body">