本文整理汇总了PHP中ilFormat::unixtimestamp2datetime方法的典型用法代码示例。如果您正苦于以下问题:PHP ilFormat::unixtimestamp2datetime方法的具体用法?PHP ilFormat::unixtimestamp2datetime怎么用?PHP ilFormat::unixtimestamp2datetime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilFormat
的用法示例。
在下文中一共展示了ilFormat::unixtimestamp2datetime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFileUploadZIPFile
/**
* Generates a ZIP file containing all file uploads for a given test and the original id of the question
*
* @param int $test_id
*/
public function getFileUploadZIPFile($test_id)
{
/** @var ilDB $ilDB */
global $ilDB;
$query = "\n\t\tSELECT \n\t\t\ttst_solutions.solution_id, tst_solutions.pass, tst_solutions.active_fi, tst_solutions.question_fi, \n\t\t\ttst_solutions.value1, tst_solutions.value2, tst_solutions.tstamp \n\t\tFROM tst_solutions, tst_active, qpl_questions \n\t\tWHERE tst_solutions.active_fi = tst_active.active_id \n\t\tAND tst_solutions.question_fi = qpl_questions.question_id \n\t\tAND tst_solutions.question_fi = %s \n\t\tAND tst_active.test_fi = %s \n\t\tORDER BY tst_solutions.active_fi, tst_solutions.tstamp";
$result = $ilDB->queryF($query, array("integer", "integer"), array($this->getId(), $test_id));
$zipfile = ilUtil::ilTempnam() . ".zip";
$tempdir = ilUtil::ilTempnam();
if ($result->numRows()) {
$userdata = array();
$data .= "<html><head>";
$data .= '<meta http-equiv="content-type" content="text/html; charset=UTF-8" />';
$data .= '<style>
table { border: 1px #333 solid; border-collapse:collapse;}
td, th { border: 1px #333 solid; padding: 0.25em;}
th { color: #fff; background-color: #666;}
</style>
';
$data .= "<title>" . $this->getTitle() . "</title></head><body>\n";
$data .= "<h1>" . $this->getTitle() . "</h1>\n";
$data .= "<table><thead>\n";
$data .= "<tr><th>" . $this->lng->txt("name") . "</th><th>" . $this->lng->txt("filename") . "</th><th>" . $this->lng->txt("pass") . "</th><th>" . $this->lng->txt("location") . "</th><th>" . $this->lng->txt("date") . "</th></tr></thead><tbody>\n";
while ($row = $ilDB->fetchAssoc($result)) {
ilUtil::makeDirParents($tempdir . "/" . $row["active_fi"] . "/" . $row["question_fi"]);
@copy($this->getFileUploadPath($test_id, $row["active_fi"], $row["question_fi"]) . $row["value1"], $tempdir . "/" . $row["active_fi"] . "/" . $row["question_fi"] . "/" . $row["value1"]);
if (!array_key_exists($row["active_fi"], $userdata)) {
include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
$userdata[$row["active_fi"]] = ilObjTestAccess::_getParticipantData($row["active_fi"]);
}
$data .= "<tr><td>" . $userdata[$row["active_fi"]] . "</td><td><a href=\"" . $row["active_fi"] . "/" . $row["question_fi"] . "/" . $row["value1"] . "\" target=\"_blank\">" . $row["value2"] . "</a></td><td>" . $row["pass"] . "</td><td>" . $row["active_fi"] . "/" . $row["question_fi"] . "/" . $row["value1"] . "</td>";
$data .= "<td>" . ilFormat::fmtDateTime(ilFormat::unixtimestamp2datetime($row["tstamp"]), $this->lng->txt("lang_dateformat"), $this->lng->txt("lang_timeformat"), "datetime", FALSE) . "</td>";
$data .= "</tr>\n";
}
$data .= "</tbody></table>\n";
$data .= "</body></html>\n";
$indexfile = $tempdir . "/index.html";
$fh = fopen($indexfile, 'w');
fwrite($fh, $data);
fclose($fh);
}
ilUtil::zip($tempdir, $zipfile);
ilUtil::delDir($tempdir);
ilUtil::deliverFile($zipfile, ilUtil::getASCIIFilename($this->getTitle() . ".zip"), "application/zip", false, true);
}