seeddms-code/views/bootstrap/class.SetExpires.php

104 lines
3.4 KiB
PHP
Raw Normal View History

2012-12-14 07:53:13 +00:00
<?php
/**
* Implementation of SetExpires view
*
* @category DMS
* @package SeedDMS
2012-12-14 07:53:13 +00:00
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2002-2005 Markus Westphal,
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
* 2010-2012 Uwe Steinmann
* @version Release: @package_version@
*/
/**
* Include parent class
*/
//require_once("class.Bootstrap.php");
2012-12-14 07:53:13 +00:00
/**
* Class which outputs the html page for SetExpires view
*
* @category DMS
* @package SeedDMS
2012-12-14 07:53:13 +00:00
* @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2002-2005 Markus Westphal,
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
* 2010-2012 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_View_SetExpires extends SeedDMS_Theme_Style {
2012-12-14 07:53:13 +00:00
function js() { /* {{{ */
header('Content-Type: application/javascript; charset=UTF-8');
?>
$(document).ready( function() {
$('#presetexpdate').on('change', function(ev){
if($(this).val() == 'date')
$('#control_expdate').show();
else
$('#control_expdate').hide();
});
});
<?php
} /* }}} */
2012-12-14 07:53:13 +00:00
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document);
2012-12-14 07:53:13 +00:00
$this->contentHeading(getMLText("set_expiry"));
if($document->expires())
$expdate = getReadableDate($document->getExpires());
2012-12-14 07:53:13 +00:00
else
$expdate = '';
?>
2017-01-04 16:53:27 +00:00
<form class="form-horizontal" action="../op/op.SetExpires.php" method="post">
2012-12-14 07:53:13 +00:00
<input type="hidden" name="documentid" value="<?php print $document->getID();?>">
2021-01-25 09:00:20 +00:00
<?php echo createHiddenFieldWithKey('setexpires'); ?>
2018-04-23 13:50:46 +00:00
<?php
$this->contentContainerStart();
$df = !empty($settings->_datetimeformat) ? $settings->_datetimeformat : 'Y-m-d H:i:s';
$options = array();
$options[] = array('never', getMLText('does_not_expire'));
$options[] = array('date', getMLText('expire_by_date'), $expdate != '');
$options[] = array('tomorrow', getMLText('expire_tomorrow').' ('.date($df, getTsByPeriod('tomorrow', 's')).')');
$options[] = array('1w', getMLText('expire_in_1w').' ('.date($df, getTsByPeriod('1w', 's')).')');
$options[] = array('1m', getMLText('expire_in_1m').' ('.date($df, getTsByPeriod('1m', 's')).')');
$options[] = array('1y', getMLText('expire_in_1y').' ('.date($df, getTsByPeriod('1y', 's')).')');
$options[] = array('2y', getMLText('expire_in_2y').' ('.date($df, getTsByPeriod('2y', 's')).')');
$options[] = array('3y', getMLText('expire_in_3y').' ('.date($df, getTsByPeriod('3y', 's')).')');
2018-04-23 13:50:46 +00:00
$this->formField(
getMLText("preset_expires"),
array(
'element'=>'select',
'id'=>'presetexpdate',
'name'=>'presetexpdate',
'options'=>$options
)
2018-04-23 13:50:46 +00:00
);
$this->formField(
getMLText("expires"),
$this->getDateChooser($expdate, "expdate", $this->params['session']->getLanguage())
);
$this->contentContainerEnd();
2020-08-27 05:52:52 +00:00
$this->formSubmit("<i class=\"fa fa-save\"></i> ".getMLText('save'));
2018-04-23 13:50:46 +00:00
?>
2012-12-14 07:53:13 +00:00
</form>
<?php
$this->contentEnd();
2012-12-14 07:53:13 +00:00
$this->htmlEndPage();
} /* }}} */
}
?>