Example #1
0
	<tr>
	<td style='vertical-align:top;width:150px;'><?php 
        echo _("Sub Start:");
        ?>
</td>
	<td><?php 
        echo format_date($resource->currentStartDate);
        ?>
</td>
	</tr>
	<?php 
    }
    ?>

	<?php 
    if (!is_null_date($resource->currentEndDate)) {
        ?>
	<tr>
	<td style='vertical-align:top;width:150px;'><?php 
        echo _("Current Sub End:");
        ?>
</td>
	<td><?php 
        echo format_date($resource->currentEndDate);
        ?>
&nbsp;&nbsp;
	<?php 
        if ($resource->subscriptionAlertEnabledInd == "1") {
            echo "<i>" . _("Expiration Alert Enabled") . "</i>";
        }
        ?>
<?php

$resourceID = $_GET['resourceID'];
$resource = new Resource(new NamedArguments(array('primaryKey' => $resourceID)));
if (!is_null_date($resource->archiveDate)) {
    $archiveChecked = 'checked';
} else {
    $archiveChecked = '';
}
//get all resource formats for output in drop down
$resourceFormatArray = array();
$resourceFormatObj = new ResourceFormat();
$resourceFormatArray = $resourceFormatObj->sortedArray();
//get all resource types for output in drop down
$resourceTypeArray = array();
$resourceTypeObj = new ResourceType();
$resourceTypeArray = $resourceTypeObj->allAsArray();
//get parents resources
$sanitizedInstance = array();
$instance = new Resource();
$parentResourceArray = array();
foreach ($resource->getParentResources() as $instance) {
    foreach (array_keys($instance->attributeNames) as $attributeName) {
        $sanitizedInstance[$attributeName] = $instance->{$attributeName};
    }
    $sanitizedInstance[$instance->primaryKeyName] = $instance->primaryKey;
    array_push($parentResourceArray, $sanitizedInstance);
}
//get all alias types for output in drop down
$aliasTypeArray = array();
$aliasTypeObj = new AliasType();
Example #3
0
            $classAdd = "class='complete'";
        }
        ?>
				<tr>
				<td <?php 
        echo $classAdd;
        ?>
 ><?php 
        echo $resourceStep->stepName;
        ?>
</td>
				<td <?php 
        echo $classAdd;
        ?>
 ><?php 
        if (is_null_date($resourceStep->stepEndDate)) {
            echo '<a href="ajax_forms.php?action=getResourceStepForm&amp;resourceStepID=' . $resourceStep->resourceStepID . '&amp;height=250&amp;width=750&amp;modal=true" class="thickbox"><img src="images/edit.gif" alt="edit" title="edit"></a>';
        }
        ?>
</td>
				<td <?php 
        echo $classAdd;
        ?>
 ><?php 
        echo $userGroup->groupName;
        ?>
</td>
				<td <?php 
        echo $classAdd;
        ?>
 ><?php 
Example #4
0
/**
 * @brief Returns a relative date string.
 *
 * Implements "3 seconds ago" etc.
 * Based on $posted_date, (UTC).
 * Results relative to current timezone.
 * Limited to range of timestamps.
 *
 * @param string $posted_date
 * @param string $format (optional) parsed with sprintf()
 *    <tt>%1$d %2$s ago</tt>, e.g. 22 hours ago, 1 minute ago
 * @return string with relative date
 */
function relative_date($posted_date, $format = null)
{
    $localtime = datetime_convert('UTC', date_default_timezone_get(), $posted_date);
    $abs = strtotime($localtime);
    if (is_null($posted_date) || is_null_date($posted_date) || $abs === false) {
        return t('never');
    }
    $etime = time() - $abs;
    if ($etime < 1) {
        return t('less than a second ago');
    }
    $a = array(12 * 30 * 24 * 60 * 60 => 'y', 30 * 24 * 60 * 60 => 'm', 7 * 24 * 60 * 60 => 'w', 24 * 60 * 60 => 'd', 60 * 60 => 'h', 60 => 'i', 1 => 's');
    foreach ($a as $secs => $str) {
        $d = $etime / $secs;
        if ($d >= 1) {
            $r = round($d);
            if (!$format) {
                $format = t('%1$d %2$s ago', 'e.g. 22 hours ago, 1 minute ago');
            }
            return sprintf($format, $r, plural_dates($str, $r));
        }
    }
}