Esempio n. 1
0
 public static function find_event($id_lang, $event_date, $pageNumber = 1, $pageSize = 1)
 {
     global $cookie;
     $id_lang = pSQL($id_lang);
     // TODO : smart page management
     if ($pageNumber < 1) {
         $pageNumber = 1;
     }
     if ($pageSize < 1) {
         $pageSize = 1;
     }
     $customer_select = "";
     $customer_join = "";
     $customer_where = "";
     if ($cookie->id_customer) {
         $customer_select = ", cg.`id_group`";
         $customer_join = "INNER JOIN `PREFIX_customer_group` cg ON (cg.`id_group` = ctg.`id_group`)";
         $customer_where = "cg.`id_customer` = {$cookie->id_customer} OR ";
     }
     $pageStart = ($pageNumber - 1) * $pageSize;
     $price_sql = Product::getProductPriceSql('p.id_product', 'pp');
     $event_date_end = normalize_date("{$event_date} + 1 day");
     // FIXME: Handle new products properly (see classes/Product.php:isNew() for corect join clause)
     $sql = "\n\t\t SELECT\n                  SQL_CALC_FOUND_ROWS p.*, pp.*, 0 as `new`, pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`name`,\n\t\t  t.`rate`, i.`id_image`, il.`legend`, m.`name` AS manufacturer_name {$customer_select}\n\t\t FROM\n\t\t  PREFIX_customization_field as f\n\t\t  JOIN PREFIX_customization_field_schedule as s on\n\t\t   not (   s.end_time < '{$event_date}'\n\t\t        or s.start_time > '{$event_date_end}')\n\t\t   and s.id_customization_field = f.id_customization_field\n\t \t  JOIN PREFIX_product p on\n\t\t   p.id_product = f.id_product\n\t\t  LEFT JOIN `PREFIX_product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = {$id_lang})\n\t\t  LEFT OUTER JOIN `PREFIX_image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)\n\t\t  LEFT JOIN `PREFIX_image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = {$id_lang})\n\n\t\t  {$price_sql}\n\t\t \n\t\t  LEFT JOIN `PREFIX_tax` t ON (pp.`id_tax` = t.`id_tax`)\n\n\t\t  LEFT JOIN `PREFIX_manufacturer` m ON (m.`id_manufacturer` = p.`id_manufacturer`)\n\t\t  LEFT JOIN `PREFIX_category_product` cp ON (cp.`id_product` = p.`id_product`)\n\t\t  INNER JOIN `PREFIX_category_group` ctg ON (ctg.`id_category` = cp.`id_category`)\n\t\t  {$customer_join}\n\n\t\t WHERE\n\t\t  p.active = 1\n\t\t  AND ({$customer_where} ctg.`id_group` = 1)\n\n\t\t GROUP BY p.`id_product`\n\n\t\t ORDER BY start_time ASC\n\n\t\t LIMIT {$pageStart}, {$pageSize}";
     $sql = str_replace('PREFIX_', _DB_PREFIX_, $sql);
     $result = Db::getInstance()->ExecuteS($sql);
     $total = Db::getInstance()->getValue('SELECT FOUND_ROWS()');
     return array('total' => $total, 'result' => Product::getProductsProperties($id_lang, $result));
 }
Esempio n. 2
0
 function getEventDates()
 {
     require_once dirname(__FILE__) . "/functions.php";
     $sql = "select distinct cast(date_format(start_time, '%Y-%m-%d') as date) as start_date, cast(date_format(end_time, '%Y-%m-%d') as date) as end_date from PREFIX_customization_field_schedule";
     $sql = str_replace('PREFIX_', _DB_PREFIX_, $sql);
     $result = Db::getInstance()->ExecuteS($sql);
     $dates = array();
     if (!empty($result)) {
         foreach ($result as $row) {
             for ($cur_date = normalize_date($row['start_date']); $cur_date != normalize_date("{$row['end_date']} + 1 day"); $cur_date = normalize_date("{$cur_date} + 1 day")) {
                 if (!in_array($cur_date, $dates)) {
                     $dates[] = $cur_date;
                 }
             }
         }
     }
     return $dates;
 }
Esempio n. 3
0
            ?>
								<td>
									<input type='text' value='<?php 
            echo $payment['year'];
            ?>
' class='changeInput year costHistoryYear' />
								</td>
								<td>
									<input type='text' value='<?php 
            echo normalize_date($payment['subscriptionStartDate']);
            ?>
' class='date-pick changeInput subscriptionStartDate costHistorySubStart' />
								</td>
								<td>
									<input type='text' value='<?php 
            echo normalize_date($payment['subscriptionEndDate']);
            ?>
' class='date-pick changeInput subscriptionEndDate costHistorySubEnd' />
								</td>
								<?php 
        }
        ?>
								<td>
									<select class='changeDefaultWhite changeInput fundID costHistoryFund' id='searchFundID'>
										<option value=''></option>
										<?php 
        $FundType = new Fund();
        $Funds = array();
        if (array_key_exists('fundID', $payment) && isset($payment['fundID'])) {
            $Funds = $FundType->getUnArchivedFundsForCostHistory($payment['fundID']);
        } else {
Esempio n. 4
0
<?php

$resourceID = $_GET['resourceID'];
$resource = new Resource(new NamedArguments(array('primaryKey' => $resourceID)));
//used to get default currency
$config = new Configuration();
$startDate = normalize_date($resource->currentStartDate);
$endDate = normalize_date($resource->currentEndDate);
//get all purchase sites for output in checkboxes
$purchaseSiteArray = array();
$purchaseSiteObj = new PurchaseSite();
$purchaseSiteArray = $purchaseSiteObj->allAsArray();
//get all acquisition types for output in drop down
$acquisitionTypeArray = array();
$acquisitionTypeObj = new AcquisitionType();
$acquisitionTypeArray = $acquisitionTypeObj->allAsArray();
//get purchase sites
$sanitizedInstance = array();
$instance = new PurchaseSite();
$resourcePurchaseSiteArray = array();
foreach ($resource->getResourcePurchaseSites() as $instance) {
    $resourcePurchaseSiteArray[] = $instance->purchaseSiteID;
}
?>
		<div id='div_resourceForm'>
		<form id='resourceForm'>
		<input type='hidden' name='editResourceID' id='editResourceID' value='<?php 
echo $resourceID;
?>
'>
Esempio n. 5
0
function egresos_detalles2()
{
    //DATOS DEL EGRESO
    liberar_bd();
    $selectDatosEgreso = 'CALL sp_sistema_select_datos_egreso(' . $_POST["idEgreso"] . ');';
    $datosEgreso = consulta($selectDatosEgreso);
    $egr = siguiente_registro($datosEgreso);
    //CUENTA
    liberar_bd();
    $selectCuenta = 'CALL sp_sistema_select_datos_cuentas(' . $egr["idCta"] . ');';
    $cuenta = consulta($selectCuenta);
    $cue = siguiente_registro($cuenta);
    $pagina = '	<div id="page-heading">	
    <ol class="breadcrumb">
        <li><a href="javascript:navegar_modulo(0);">Dashboad</a></li> 
        <li><a href="javascript:navegar_modulo(' . $_SESSION["mod"] . ');">' . $_SESSION["moduloPadreActual"] . '</a></li>    
        <li class="active">
            ' . $_SESSION["moduloHijoActual"] . '
        </li>
    </ol>  
    <h1>' . $_SESSION["moduloHijoActual"] . '</h1>
    <div class="options">
        <div class="btn-toolbar">									
        </div>
    </div>										
</div>
<div class="container">							
    <div class="row">
        <div class="col-sm-12">
            <div class="panel panel-danger">
                <div class="panel-heading">
                    <h4>Detalles de egreso</h4>
                </div>
                <div class="panel-body" style="border-radius: 0px;">
                    <div class="form-horizontal">
                        <div class="form-group">
                            <label for="entidadIngr" class="col-sm-3 control-label">Entidad:</label>
                            <div class="col-sm-6">
                                <input type="text" readonly="readonly" 
				class="form-control" id="entidadIngr" name="entidadIngr" maxlength="100" 
				value="' . utf8_encode($egr["entidad"]) . '"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="idCuenta" class="col-sm-3 control-label">Cuenta:</label>
                            <div class="col-sm-6">
                                <input type="text" readonly="readonly" class="form-control" 
				id="idCuenta" name="idCuenta" maxlength="100" value="' . utf8_encode($cue["banco"]) . '(' . $cue["numero"] . ')"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="montoEgr" class="col-sm-3 control-label">Monto:</label>
                            <div class="col-sm-6">
                                <input type="text" readonly="readonly" class="form-control" 
				id="montoEgr" name="montoEgr" maxlength="100" value="' . number_format($egr["cantidad"], 2) . '"/>
                            </div>				
                        </div>
                        <div class="form-group">
                            <label for="datepicker" class="col-sm-3 control-label">Fecha de egreso:</label>
                            <div class="col-sm-6">
                                <input type="text" readonly="readonly" class="form-control" 
				id="datepicker" name="datepicker" maxlength="100" value="' . normalize_date($egr["fecha"]) . '"/>
                            </div>						
                        </div>	
                        <div class="form-group">
                            <label for="conceptoEgr" class="col-sm-3 control-label">Concepto:</label>
                            <div class="col-md-6">	
                                <textarea readonly="readonly" class="form-control autosize" 
				name="conceptoEgr" id="conceptoEgr">' . utf8_encode($egr["concepto"]) . '</textarea>
                            </div>													
                        </div>										
                        <div class="form-group">
                            <label for="txtEgreso" class="col-sm-3 control-label">Observaciones:</label>
                            <div class="col-md-6">	
                                <textarea readonly="readonly" class="form-control autosize" 
				name="txtEgreso" id="txtEgreso">' . utf8_encode($egr["txt"]) . '</textarea>
                            </div>						
                        </div>									
                    </div>
                </div>
                <div class="panel-footer">
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="btn-toolbar btnsGuarCan">
                                <i class="btn-danger btn" onclick="navegar();">Cancelar</i>
                                <i class="btn-success btn" onclick="navegar(\'Guardar\');">Guardar</i>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>';
    return $pagina;
}
function uw_waterloo_quest_schedule($input, $format, $summary = '@code @type in @location', $description = '@code-@section: @name (@type) in @location with @prof')
{
    //icalendar day formats
    $arr_days = array('m' => 'MO', 't' => 'TU', 'w' => 'WE', 'h' => 'TH', 'f' => 'FR', 's' => 'SA', 'u' => 'SU');
    $arr_num_days = array('m' => 1, 't' => 2, 'w' => 3, 'h' => 4, 'f' => 5, 's' => 6, 'u' => 7);
    //info that Quest gives us and schedule field it's useful for
    $code = '';
    $name = '';
    $section = '';
    $type = '';
    $days = '';
    $time_start = '';
    $time_end = '';
    $location = '';
    $prof = '';
    $date_start = '';
    $date_end = '';
    //the result of this madness will be stored here
    $ical_array = array();
    $js_array = array();
    //start at the beginning of the string
    $pos = 0;
    //this is how long our quest schedule is
    $total_length = strlen($input);
    //detect whether MM and DD needs to be swapped according to locale
    //if en-CA, swap
    //otherwise, no swap
    $swap = false;
    $locale = $_SERVER["HTTP_ACCEPT_LANGUAGE"];
    if (strpos($locale, 'en-CA') !== FALSE) {
        $swap = true;
    }
    //start the algorithm
    while ($pos < $total_length && $pos >= 0) {
        //assume we didn't find anything
        $found_what_we_need = false;
        //the regex will match 1 of 3 completely different things - title, body, or partial body
        //we have to process what we get in order
        //detect if it's 24h time or 12h time!
        $ampm = false;
        if (preg_match('/(AM)|(PM)/', $input)) {
            $ampm = true;
        }
        $time = $ampm ? '([1]{0,1}\\d\\:[0-5]\\d[AP]M)\\ -\\ 
        ([1]{0,1}\\d\\:[0-5]\\d[AP]M)\\s+' : '(\\d{2}\\:\\d{2})\\ -\\ (\\d{2}\\:\\d{2})\\s+';
        $regex = '/
    (
      (\\w{2,5}\\ \\w{3,4})\\ -\\                        #code
      ([^\\r\\n]+)                                    #name
    )
    |
    (
      \\d{4}\\s+                                      #class number
      (\\d{3})\\s+                                    #section
      (\\w{3})\\s+                                    #component
      ([MThWF]{0,6})\\s+                             #days and times
      ' . $time . '
      ([\\w\\ ]+\\s+[0-9]{1,5}[A-Z]?|TBA)\\s+           #room
      ([\\w\\ \\-\\,\\r\\n]+)\\s+                          #instructor
      (\\d{2,4}\\/\\d{2,4}\\/\\d{2,4})\\ -\\ 
      (\\d{2,4}\\/\\d{2,4}\\/\\d{2,4})
    )
    |
    (
      ([MThWF]{0,6})\\s+
      ' . $time . '
      ([\\w\\ ]+\\s+[0-9]{1,5}[A-Z]?|TBA)\\s+
      ([\\w\\ \\-\\,\\r\\n]+)\\s+
      (\\d{2,4}\\/\\d{2,4}\\/\\d{2,4})\\ -\\ 
      (\\d{2,4}\\/\\d{2,4}\\/\\d{2,4})
    )/x';
        if (preg_match($regex, $input, $matches, PREG_OFFSET_CAPTURE, $pos)) {
            //check what we found by seeing where the regex stopped
            $number = count($matches);
            switch ($number) {
                //found title
                case 4:
                    //get the strings and put them in the variables
                    $code = $matches[2][0];
                    $name = trim($matches[3][0]);
                    //reset the rest of the variables so if something goes wrong, the error doesn't perpetuate
                    $section = '';
                    $type = '';
                    $days = '';
                    $time = '';
                    $location = '';
                    $prof = '';
                    break;
                    //found body
                //found body
                case 14:
                    $found_what_we_need = true;
                    $section = $matches[5][0];
                    $type = $matches[6][0];
                    $days = strtolower(str_replace('Th', 'h', $matches[7][0]));
                    $time_start = _uw_build_time_string($matches[8][0], $ampm);
                    $time_end = _uw_build_time_string($matches[9][0], $ampm);
                    $location = trim(_uw_StripExtraSpace($matches[10][0]));
                    //$prof =substr(strrchr(' '.trim($matches[11][0]), ' '),1);//get only the last name
                    $prof = trim($matches[11][0]);
                    $date_start = strtotime(normalize_date($matches[12][0], $swap));
                    $date_end = strtotime(normalize_date($matches[13][0], $swap));
                    break;
                    //found partial body
                //found partial body
                case 22:
                    $found_what_we_need = true;
                    $days = strtolower(str_replace('Th', 'h', $matches[15][0]));
                    $time_start = _uw_build_time_string($matches[16][0], $ampm);
                    $time_end = _uw_build_time_string($matches[17][0], $ampm);
                    $location = trim(_uw_StripExtraSpace($matches[18][0]));
                    //$prof=substr(strrchr(' '.trim($matches[17][0]), ' '),1);//get only the last name
                    $prof = trim($matches[19][0]);
                    $date_start = strtotime(normalize_date($matches[20][0], $swap));
                    $date_end = strtotime(normalize_date($matches[21][0], $swap));
                    break;
            }
            //move to the end of what was matched and continue
            $pos = $matches[0][1] + strlen($matches[0][0]);
        } else {
            $pos = -1;
        }
        //this exits the while because we are done if we can't find anything we're looking for
        //add to the array if we have all the info.
        if ($found_what_we_need && $days != '') {
            if ($format == 'icalendar') {
                //format the days of the week
                $formatted_days = '';
                $number_days = array();
                foreach (str_split($days) as $day) {
                    $formatted_days .= ',' . $arr_days[$day];
                    $number_days[] = $arr_num_days[$day];
                }
                $formatted_days = substr($formatted_days, 1);
                //move the start date to the first valid day of the week
                while (!in_array(date('N', $date_start), $number_days)) {
                    $date_start = strtotime('+1 day', $date_start);
                }
                //build the result
                $string_data = array('@code' => $code, '@section' => $section, '@name' => $name, '@type' => $type, '@location' => $location, '@prof' => $prof);
                $result = array('summary' => strtr($summary, $string_data), 'description' => strtr($description, $string_data), 'start' => date('Ymd', $date_start) . 'T' . $time_start, 'end' => date('Ymd', $date_start) . 'T' . $time_end, 'location' => $location);
                //this information is only relevant for repeating events
                if ($date_start != $date_end) {
                    $result['until'] = date('Ymd', $date_end) . 'T' . $time_end;
                    $result['days'] = $formatted_days;
                }
                //escape commas
                //see rfc2445 section 4.1
                $result['description'] = str_replace("\r\n", "\r\n ", str_replace(',', '\\,', $result['description']));
                $result['summary'] = str_replace("\r\n", "\r\n ", str_replace(',', '\\,', $result['summary']));
                //add this class to the list
                $ical_array[] = $result;
            } elseif ($format == 'js') {
                $location = explode(' ', $location);
                $result = array('code' => $code, 'name' => $name, 'section' => $section, 'type' => $type, 'days' => $days, 'time_start' => $time_start, 'time_end' => $time_end, 'location' => $location[0], 'prof' => $prof, 'date_start' => $date_start, 'date_end' => $date_end);
                $js_array[] = $result;
            }
        }
    }
    if ($format == 'icalendar') {
        $result_str = '';
        foreach ($ical_array as $class) {
            $result_str .= "\r\nBEGIN:VEVENT";
            $result_str .= "\r\nDTSTART:{$class['start']}";
            $result_str .= "\r\nDTEND:{$class['end']}";
            if (array_key_exists('until', $class) && $class['until']) {
                $result_str .= "\r\nRRULE:FREQ=WEEKLY;UNTIL={$class['until']};WKST=SU;BYDAY={$class['days']}";
            }
            $result_str .= "\r\nSUMMARY:{$class['summary']}";
            $result_str .= "\r\nLOCATION:{$class['location']}";
            $result_str .= "\r\nDESCRIPTION:{$class['description']}";
            $result_str .= "\r\nEND:VEVENT";
        }
        $result_str = "BEGIN:VCALENDAR" . "\r\nVERSION:2.0" . "\r\nPRODID:-//hacksw/handcal//NONSGML v1.0//EN" . $result_str . "\r\nEND:VCALENDAR";
        return $result_str;
    } elseif ($format = 'js') {
        return $js_array;
    }
}
</thead>

<tbody>
			<?php 
if (count($paymentArray) > 0) {
    $i = 0;
    foreach ($paymentArray as $payment) {
        $i++;
        if ($i % 2 == 0) {
            $classAdd = "class='alt'";
        } else {
            $classAdd = "";
        }
        $year = $payment['year'] ? $payment['year'] : "&nbsp;";
        $subStart = $payment['subscriptionStartDate'] ? normalize_date($payment['subscriptionStartDate']) : "&nbsp;";
        $subEnd = $payment['subscriptionEndDate'] ? normalize_date($payment['subscriptionEndDate']) : "&nbsp;";
        $fundName = $payment['fundName'] ? $payment['fundName'] : "&nbsp;";
        if (integer_to_cost($payment['paymentAmount'])) {
            $cost = $payment['currencyCode'] . " " . integer_to_cost($payment['paymentAmount']);
        } else {
            $cost = "&nbsp;";
        }
        $costDetails = $payment['costDetails'] ? $payment['costDetails'] : "&nbsp;";
        $costNote = $payment['costNote'] ? $payment['costNote'] : "&nbsp;";
        $invoiceNum = $payment['invoiceNum'] ? $payment['invoiceNum'] : "&nbsp;";
        ?>
				<tr>
			<?php 
        if ($enhancedCostFlag) {
            ?>
				<td <?php 
Esempio n. 8
0
function process_html($output, $writer)
{
    //get creator metadata
    preg_match('/c\\.User\\.set_viewed\\((.*)\\);\\n/', $output, $matches);
    $ids = array();
    if (isset($matches[1])) {
        $user = json_decode(trim($matches[1]));
        $userId = $user->id;
        $userName = $user->display_name;
        $url = $user->url;
        //process works
        preg_match_all('/workJSON:(.*)\\n/', $output, $works);
        $count = 0;
        $writer->startElement('response');
        $writer->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
        $writer->writeElement('id', $userId);
        $writer->writeElement('name', $userName);
        $writer->writeElement('url', $url);
        if (isset($works[1])) {
            $writer->startElement('records');
            foreach ($works[1] as $work) {
                $obj = json_decode(trim($work));
                //only gather those papers where the owner_id is the current user id.
                //Note: 17 Feb - gather all publications, including those in which the current user is not owner (tagged co-author)
                //$obj->owner_id == $userId &&
                if (!in_array($obj->id, $ids)) {
                    //only process papers, etc. that have associated document/presentation files
                    if ($obj->attachments) {
                        //add id into array of ids to prevent processing of duplicates in a page
                        $ids[] = $obj->id;
                        //gather metadata
                        $metadata = $obj->metadata;
                        //begin record metadata
                        $writer->startElement('record');
                        //by default, set migrate to boolean(true) to enable file upload and document migration
                        $writer->writeAttribute('migrate', 'true');
                        $writer->writeElement('id', $obj->id);
                        $writer->writeElement('title', $obj->title);
                        $writer->writeElement('url', $obj->internal_url);
                        $writer->writeElement('access_right', 'open');
                        $writer->writeElement('license', 'cc-by');
                        if (isset($obj->section)) {
                            if ($obj->section == 'Papers') {
                                $writer->writeElement('upload_type', 'publication');
                                //if there are conference dates, then automatically set the publication_type as 'conferencepaper', othewise assume
                                //it is an article
                                if (isset($metadata->conference_start_date) || isset($metadata->conference_end_date)) {
                                    $writer->writeElement('publication_type', 'conferencepaper');
                                } else {
                                    $writer->writeElement('publication_type', 'article');
                                }
                            } else {
                                if ($obj->section == 'Talks') {
                                    $writer->writeElement('upload_type', 'presentation');
                                }
                            }
                        } else {
                            //set defaults if there is no section
                            $writer->writeElement('upload_type', 'publication');
                            if (isset($metadata->conference_start_date) || isset($metadata->conference_end_date)) {
                                $writer->writeElement('publication_type', 'conferencepaper');
                            } else {
                                $writer->writeElement('publication_type', 'article');
                            }
                        }
                        //description is mandator, extract from academia abstract when possible, otherwise create blank element
                        if (isset($metadata->abstract)) {
                            $writer->writeElement('description', preg_replace("/\r|\n/", "", $metadata->abstract));
                        } else {
                            $writer->writeElement('description');
                        }
                        //publication date is mandatory
                        if (isset($metadata->publication_date)) {
                            foreach ($metadata->publication_date as $k => $v) {
                                if ($k != 'errors') {
                                    if (is_int($v)) {
                                        $writer->writeElement('publication_' . $k, $v);
                                    } else {
                                        $writer->writeElement('publication_' . $k, '');
                                    }
                                }
                            }
                        } else {
                            $writer->writeElement('publication_day');
                            $writer->writeElement('publication_month');
                            $writer->writeElement('publication_year');
                        }
                        //write empty publication_date element, to be manipulated in the XForms engine
                        $writer->writeElement('publication_date');
                        $writer->writeElement('publication_date_valid', 'false');
                        if (isset($metadata->conference_start_date) || isset($metadata->conference_end_date)) {
                            $date = '';
                            $date .= normalize_date($metadata->conference_start_date);
                            if (isset($metadata->conference_start_date)) {
                                $date .= ' - ';
                            }
                            $date .= normalize_date($metadata->conference_end_date);
                            if (isset($date)) {
                                $writer->writeElement('conference_dates', $date);
                            }
                            //extract journal title, publication name, or organization as the conference title
                            if (isset($metadata->journal_name)) {
                                $writer->writeElement('conference_title', $metadata->journal_name);
                            } else {
                                if (isset($metadata->organization)) {
                                    $writer->writeElement('conference_title', $metadata->organization);
                                } else {
                                    if (isset($metadata->publication_name)) {
                                        $writer->writeElement('conference_title', $metadata->publication_name);
                                    }
                                }
                            }
                        }
                        //assume location is the conference location
                        if (isset($metadata->location)) {
                            //insert mandatory conference title if there's a location, but no conference dates
                            if (!isset($metadata->conference_start_date) == 0 && !isset($metadata->conference_end_date)) {
                                $writer->writeElement('conference_title', '');
                            }
                            $writer->writeElement('conference_place', $metadata->location);
                        }
                        //insert journal title if conference dates are not used
                        if (!isset($metadata->conference_start_date) && !isset($metadata->conference_end_date)) {
                            if (isset($metadata->journal_name)) {
                                $writer->writeElement('journal_title', $metadata->journal_name);
                            } else {
                                if (isset($metadata->publication_name)) {
                                    $writer->writeElement('journal_title', $metadata->publication_name);
                                }
                            }
                        }
                        //begin creators
                        $writer->startElement('creators');
                        //insert creator for self
                        $writer->startElement('creator');
                        if (isset($user->department->university->name)) {
                            $writer->writeAttribute('affiliation', $user->department->university->name);
                        }
                        $writer->text($userName);
                        $writer->endElement();
                        //list co-authors
                        if (is_array($obj->co_author_tags)) {
                            foreach ($obj->co_author_tags as $creator) {
                                $writer->startElement('creator');
                                $writer->writeAttribute('affiliation', $creator->affiliation);
                                $writer->text($creator->name);
                                $writer->endElement();
                            }
                        }
                        //end creators
                        $writer->endElement();
                        //keywords
                        if ($obj->research_interests) {
                            $writer->startElement('keywords');
                            foreach ($obj->research_interests as $keyword) {
                                $writer->writeElement('keyword', $keyword->name);
                            }
                            $writer->endElement();
                        }
                        //create file element
                        $writer->startElement('file');
                        $writer->writeAttribute('xsi:type', 'xs:anyURI');
                        $writer->writeAttribute('filename', '');
                        $writer->writeAttribute('mediatype', '');
                        $writer->writeAttribute('size');
                        $writer->endElement();
                        //end individual record
                        $writer->endElement();
                    }
                }
                $count++;
            }
            //end records
            $writer->endElement();
        } else {
            $writer->writeElement('error', 'No works associated with this user id were parsed.');
        }
        //end response
        $writer->endElement();
        //var_dump($obj);
    } else {
        $writer->startElement('response');
        $writer->writeElement('error', 'Unable to parse creator metadata to extract user id.');
        $writer->endElement();
    }
}
Esempio n. 9
0
$bill_base = trim(@$_REQUEST["bill_base"]);
//--- do checks
unset($errorlist);
$errorlist = array();
if (strlen($dur_start) <= 0) {
    $errorlist[] = __("Kein g&uuml;ltiger Startzeitpunkt angegeben");
} else {
    $real_dur_start = normalize_date($dur_start, 0);
    if ($real_dur_start == "1970-01-01") {
        $errorlist[] = __("Kein g&uuml;ltiger Startzeitpunkt angegeben");
    }
}
if (strlen($dur_end) <= 0) {
    $errorlist[] = __("Kein g&uuml;ltiger Endzeitpunkt angegeben");
} else {
    $real_dur_end = normalize_date($dur_end, 1);
    if ($real_dur_end == "1970-01-01") {
        $errorlist[] = __("Kein g&uuml;ltiger Endzeitpunkt angegeben");
    }
}
if (strlen($caller_source) <= 0) {
    $errorlist[] = __("Keine Nebenstelle angegeben");
}
if (strlen($price) <= 0) {
    $price = $billing_pricepermin_default;
}
if (strlen($vat_value) <= 0) {
    $vat_value = $billing_vat;
} else {
    $vat_value = $vat_value / 100;
}
Esempio n. 10
0
}
function array_to_csv_row($array)
{
    $escaped_array = array_map("escape_csv", $array);
    return implode(",", $escaped_array) . "\r\n";
}
$queryDetails = Resource::getSearchDetails();
$whereAdd = $queryDetails["where"];
$searchDisplay = $queryDetails["display"];
$orderBy = $queryDetails["order"];
//get the results of the query into an array
$resourceObj = new Resource();
$resourceArray = array();
$resourceArray = $resourceObj->export($whereAdd, $orderBy);
$replace = array("/", "-");
$excelfile = "resources_export_" . str_replace($replace, "_", format_date(date('Y-m-d'))) . ".csv";
header("Pragma: public");
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=\"" . $excelfile . "\"");
$columnHeaders = array("Record ID", "Name", "Type", "Format", "Date Created", "User Created", "Date Updated", "User Updated", "Status", "ISSN/ISBN", "Resource URL", "Alt URL", "Organizations", "Aliases", "Parent Record", "Child Record", "Acquisition Type", "Cost", "Order Number", "System Number", "Purchasing Sites", "Sub Start", "Current Sub End", "Subscription Alert Enabled", "License Names", "License Status", "Authorized Sites", "Administering Sites", "Authentication Type", "Access Method", "Storage Location", "Simultaneous User Limit", "Coverage", "Username", "Password", "Cataloging Type", "Cataloging Status", "Catalog Record Set Identifier", "Catalog Record Source URL", "Catalog Records Available", "Catalog Records Loaded", "OCLC Holdings Updated");
echo array_to_csv_row(array("Resource Record Export " . format_date(date('Y-m-d'))));
if (!$searchDisplay) {
    $searchDisplay = array("All Resource Records");
}
echo array_to_csv_row(array(implode('; ', $searchDisplay)));
echo array_to_csv_row($columnHeaders);
foreach ($resourceArray as $resource) {
    $updateDateFormatted = normalize_date($resource['updateDate']);
    $resourceValues = array($resource['resourceID'], $resource['titleText'], $resource['resourceType'], $resource['resourceFormat'], format_date($resource['createDate']), $resource['createName'], $updateDateFormatted, $resource['updateName'], $resource['status'], $resource['isbnOrISSN'], $resource['resourceURL'], $resource['resourceAltURL'], $resource['organizationNames'], $resource['aliases'], $resource['parentResources'], $resource['childResources'], $resource['acquisitionType'], $resource['payments'], $resource['orderNumber'], $resource['systemNumber'], $resource['purchasingSites'], $resource['currentStartDate'], $resource['currentEndDate'], $resource['subscriptionAlertEnabledInd'] ? 'Y' : 'N', $resource['licenseNames'], $resource['licenseStatuses'], $resource['authorizedSites'], $resource['administeringSites'], $resource['authenticationType'], $resource['accessMethod'], $resource['storageLocation'], $resource['userLimit'], $resource['coverage'], $resource['authenticationUserName'], $resource['authenticationPassword'], $resource['catalogingType'], $resource['catalogingStatus'], $resource['recordSetIdentifier'], $resource['bibSourceURL'], $resource['numberRecordsAvailable'], $resource['numberRecordsLoaded'], $resource['hasOclcHoldings'] ? 'Y' : 'N');
    echo array_to_csv_row($resourceValues);
}