本文整理汇总了PHP中files::getFilesByModule方法的典型用法代码示例。如果您正苦于以下问题:PHP files::getFilesByModule方法的具体用法?PHP files::getFilesByModule怎么用?PHP files::getFilesByModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类files
的用法示例。
在下文中一共展示了files::getFilesByModule方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$tpl = new template();
$id = (int) $_GET['id'];
if ($id > 0) {
$lead = $this->getLead($id);
// Comments
$comments = new comments();
if (isset($_POST['comment']) === true) {
$values = array('text' => $_POST['text'], 'date' => date("Y-m-d H:i:s"), 'userId' => $_SESSION['userdata']['id'], 'moduleId' => $id, 'commentParent' => $_POST['father']);
$comments->addComment($values, 'lead');
}
// files
$file = new files();
if (isset($_POST['upload'])) {
if (isset($_FILES['file'])) {
$file->upload($_FILES, 'lead', $id);
$tpl->setNotification('FILE_UPLOADED', 'success');
} else {
$tpl->setNotification('NO_FILE', 'error');
}
}
$files = new files();
$tpl->assign('files', $files->getFilesByModule('lead', $id));
$tpl->assign('comments', $comments->getComments('lead', $id));
$tpl->assign('contactInfo', $this->getLeadContact($id));
$tpl->assign('lead', $lead);
} else {
$tpl->display('general.error');
}
$tpl->display('leads.showLead');
}
示例2: run
/**
* run - display template and edit data
*
* @access public
*/
public function run()
{
$tpl = new template();
$id = '';
if (isset($_GET['id']) === true) {
$id = (int) $_GET['id'];
}
$client = $this->getClient($id);
if (empty($client) === false) {
$file = new files();
$project = new projects();
$msgKey = '';
if ($_SESSION['userdata']['role'] == 'admin') {
$tpl->assign('admin', true);
}
if (isset($_POST['upload'])) {
if (isset($_FILES['file'])) {
$msgKey = $file->upload($_FILES, 'client', $id);
}
}
$comment = new comments();
//Add comment
if (isset($_POST['comment']) === true) {
$mail = new mailer();
$values = array('text' => $_POST['text'], 'date' => date("Y-m-d H:i:s"), 'userId' => $_SESSION['userdata']['id'], 'moduleId' => $id, 'commentParent' => $_POST['father']);
$comment->addComment($values, 'client');
}
$tpl->assign('userClients', $this->getClientsUsers($id));
$tpl->assign('comments', $comment->getComments('client', $id));
$tpl->assign('imgExtensions', array('jpg', 'jpeg', 'png', 'gif', 'psd', 'bmp', 'tif', 'thm', 'yuv'));
$tpl->assign('info', $msgKey);
$tpl->assign('client', $client);
$tpl->assign('clientProjects', $project->getClientProjects($id));
$tpl->assign('files', $file->getFilesByModule('client'));
//var_dump($file->getFilesByModule('client')); die();
$tpl->display('clients.showClient');
} else {
$tpl->display('general.error');
}
}
示例3: run
/**
* run - display template and edit data
*
* @access public
*
*/
public function run()
{
$login = new login(session::getSID());
//Check if user is logged in
if ($login->logged_in() !== true) {
exit;
}
$helper = new helper();
$projects = new projects();
$tickets = new tickets();
$module = $_GET['module'];
//Organize ajax handlers by module and action
if ($module == "tickets.showAll") {
// AJAX status change
if (isset($_POST['ticketId'])) {
$ticketId = $_POST['ticketId'];
$newStatus = $_POST['newStatus'];
if ($tickets->getAccessRights($ticketId)) {
if ($tickets->changeStatus($ticketId, $newStatus) === true) {
echo "Status was changed";
} else {
echo "Error with change";
}
} else {
echo "You have no rights to do that.";
}
}
} else {
if ($module == "tickets.showTicket") {
$users = new users();
$id = $_GET['id'];
$results = $tickets->getTimelineHistory($id);
$ticket = $tickets->getTicket($id);
$jsonArr = array();
$description = strip_tags($ticket['description']);
$description = str_replace("\n", "", $description);
$description = str_replace("\r", "", $description);
$json = '{"timeline":
{ "headline":"Ticket History for ' . $ticket['headline'] . '",
"type":"default",
"text":"' . $description . '",
"startDate":"' . $ticket['timelineDate'] . '",
"date": [ ';
//Creation Date
$items[] = '{
"startDate":"' . $ticket['timelineDate'] . '",
"headline":"Ticket Created",
"text":"<p>Ticket created by ' . $ticket['userFirstname'] . ', ' . $ticket['userLastname'] . '</p>",
"asset":
{ "media":"",
"credit":"",
"caption":""
}
}';
foreach ($results as $row) {
$items[] = '{
"startDate":"' . $row['date'] . '",
"headline":"Ticket Update",
"text":"<p>' . $row['firstname'] . ', ' . $row['lastname'] . ' changed ' . $row['changeType'] . ' to ' . $row['changeValue'] . '</p>",
"asset":
{ "media":"' . $users->getProfilePicture($row['userId']) . '",
"credit":"' . $row['firstname'] . ', ' . $row['lastname'] . '",
"caption":""
}
}';
}
$comments = new comments();
$allcomments = $comments->getComments('ticket', $id);
foreach ($allcomments as $comment) {
$items[] = '{
"startDate":"' . $comment['timelineDate'] . '",
"headline":"New Comment",
"text":' . json_encode('<p>' . $comment['firstname'] . ', ' . $comment['lastname'] . ' said:<br /> </p>' . $comment['text']) . ',
"asset":
{ "media":"' . $users->getProfilePicture($comment['userId']) . '",
"credit":"' . $comment['firstname'] . ', ' . $comment['lastname'] . '",
"caption":""
}
}';
}
$file = new files();
$files = $file->getFilesByModule('ticket', $id);
$tempStr = '';
$tempStr3 = '';
$imgExtensions = array('jpg', 'jpeg', 'png', 'gif', 'psd', 'bmp', 'tif', 'thm', 'yuv');
foreach ($files as $fileRow) {
if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/userdata/' . $fileRow['module'] . '/' . $fileRow['encName'] . '.' . $fileRow['extension'])) {
$tempStr3 .= "<img style='max-height: 50px; max-width: 70px;' src='userdata/" . $fileRow["module"] . "/" . $fileRow['encName'] . "." . $fileRow["extension"] . "' />";
$filepath = "userdata/" . $fileRow["module"] . "/" . $fileRow['encName'] . "." . $fileRow["extension"] . "";
} else {
$tempStr3 .= "<img style='max-height: 50px; max-width: 70px;' src='userdata/file.png' />";
$filepath = "userdata/file.png";
}
$tempStr = '{
//.........这里部分代码省略.........