public static function showQuickNote() { $note = QuickNote::getRandomNote(); $note_content = $note['note_content']; $note_html = "<div class=\"alert alert-info\">\n\t\t\t<button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button>{$note_content}</div>"; Template::assign("osadmin_quick_note", $note_html); }
function createNote($ext_id) { global $thisstaff; if (!$thisstaff) { Http::response(403, "Login required"); } elseif (!isset($_POST['note']) || !$_POST['note']) { Http::response(422, "Send `note` parameter"); } elseif (!($note = QuickNote::create(array('staff_id' => $thisstaff->getId(), 'body' => Format::sanitize($_POST['note']), 'created' => new SqlFunction('NOW'), 'ext_id' => $ext_id)))) { Http::response(500, "Unable to create new note"); } elseif (!$note->save(true)) { Http::response(500, "Unable to create new note"); } $show_options = true; include STAFFINC_DIR . 'templates/note.tmpl.php'; }
</a></li> <li><a id="notes_tab" href="#notes"><i class="icon-pushpin"></i> <?php echo __('Notes'); ?> </a></li> </ul> <div id="tickets" class="tab_content"> <?php include STAFFINC_DIR . 'templates/tickets.tmpl.php'; ?> </div> <div class="tab_content" id="notes" style="display:none"> <?php $notes = QuickNote::forUser($user); $create_note_url = 'users/' . $user->getId() . '/note'; include STAFFINC_DIR . 'templates/notes.tmpl.php'; ?> </div> <div style="display:none;" class="dialog" id="confirm-action"> <h3><?php echo __('Please Confirm'); ?> </h3> <a class="close" href=""><i class="icon-remove-circle"></i></a> <hr/> <p class="confirm-action" style="display:none;" id="banemail-confirm"> <?php echo sprintf(__('Are you sure you want to <b>ban</b> %s?'), $user->getEmail());
class="icon-pushpin"></i> <?php echo __('Notes'); ?></a></li> </ul> <div class="tab_content" id="users"> <?php include STAFFINC_DIR . 'templates/users.tmpl.php'; ?> </div> <div class="tab_content" id="tickets" style="display:none;"> <?php include STAFFINC_DIR . 'templates/tickets.tmpl.php'; ?> </div> <div class="tab_content" id="notes" style="display:none"> <?php $notes = QuickNote::forOrganization($org); $create_note_url = 'orgs/'.$org->getId().'/note'; include STAFFINC_DIR . 'templates/notes.tmpl.php'; ?> </div> <script type="text/javascript"> $(function() { $(document).on('click', 'a.org-action', function(e) { e.preventDefault(); var url = 'ajax.php/'+$(this).attr('href').substr(1); $.dialog(url, [201, 204], function (xhr) { if (xhr.status == 204) window.location.href = 'orgs.php'; else window.location.href = window.location.href;
<?php if (($org=$user->getOrganization())) { ?> <div style="margin-top: 7px;"><?php echo $org->getName(); ?></div> <?php } ?> <div class="clear"></div> <ul class="tabs" style="margin-top:5px"> <li><a href="#info-tab" class="active" ><i class="icon-info-sign"></i> <?php echo __('User'); ?></a></li> <?php if ($org) { ?> <li><a href="#organization-tab" ><i class="icon-fixed-width icon-building"></i> <?php echo __('Organization'); ?></a></li> <?php } $ext_id = "U".$user->getId(); $notes = QuickNote::forUser($user, $org)->all(); ?> <li><a href="#notes-tab" ><i class="icon-fixed-width icon-pushpin"></i> <?php echo __('Notes'); ?></a></li> </ul> <div class="tab_content" id="info-tab"> <div class="floating-options"> <a href="<?php echo $info['useredit'] ?: '#'; ?>" id="edituser" class="action" title="<?php echo __('Edit'); ?>"><i class="icon-edit"></i></a> <a href="users.php?id=<?php echo $user->getId(); ?>" title="<?php echo __('Manage User'); ?>" class="action"><i class="icon-share"></i></a> </div> <table class="custom-info" width="100%"> <?php foreach ($user->getDynamicData() as $entry) { ?> <tr><th colspan="2"><strong><?php echo $entry->getForm()->get('title'); ?></strong></td></tr>
extract($_REQUEST, EXTR_IF_EXISTS); Common::checkParam($note_id); $quicknote = QuickNote::getNoteById($note_id); if (empty($quicknote)) { Common::exitWithError(ErrorMessage::QUICKNOTE_NOT_EXIST, "panel/quicknotes.php"); } if (Common::isPost()) { $note_content = Common::filterText($note_content); if ($note_content == "") { OSAdmin::alert("error", ErrorMessage::NEED_PARAM); } else { $current_user_info = UserSession::getSessionInfo(); $user_group = $current_user_info['user_group']; $current_user_id = $current_user_info['user_id']; if ($user_group == 1 || $quicknote['owner_id'] == $current_user_id) { $note_content = htmlspecialchars($note_content); $update_data = array('note_content' => $note_content); $result = QuickNote::updateNote($note_id, $update_data); if ($result >= 0) { SysLog::addLog(UserSession::getUserName(), 'MODIFY', 'QuickNote', $note_id, json_encode($update_data)); Common::exitWithSuccess('更新完成', 'panel/quicknotes.php'); } else { OSAdmin::alert("error"); } } else { OSAdmin::alert("error", ErrorMessage::QUICKNOTE_NOT_OWNER); } } } Template::assign('quicknote', $quicknote); Template::display('panel/quicknote_modify.tpl');
$start = ($page_no - 1) * $page_size; $current_user_info = UserSession::getSessionInfo(); $user_group = $current_user_info['user_group']; $current_user_id = $current_user_info['user_id']; if ($method == 'del' && !empty($note_id)) { $note = QuickNote::getNoteById($note_id); //是超级管理员组的成员或者是quicknote的主人 if ($user_group == 1 || $note['owner_id'] == $current_user_id) { $result = QuickNote::delNote($note_id); if ($result > 0) { SysLog::addLog(UserSession::getUserName(), 'DELETE', 'QuickNote', $note_id, json_encode($note)); Common::exitWithSuccess('便签删除成功', 'panel/quicknotes.php'); } else { OSAdmin::alert("error"); } } else { OSAdmin::alert("error", ErrorMessage::QUICKNOTE_NOT_OWNER); } } $quicknotes = QuickNote::getNotes($start, $page_size); $confirm_html = OSAdmin::renderJsConfirm("icon-remove"); $page_html = Pagination::showPager("", $page_no, PAGE_SIZE, $row_count); Template::assign('page_no', $page_no); Template::assign('page_size', PAGE_SIZE); Template::assign('row_count', $row_count); Template::assign('page_html', $page_html); Template::assign('quicknotes', $quicknotes); Template::assign('osadmin_action_confirm', $confirm_html); Template::assign('user_group', $user_group); Template::assign('current_user_id', $current_user_id); Template::display('panel/quicknotes.tpl');
<?php require '../include/init.inc.php'; $note_content = ''; extract($_POST, EXTR_IF_EXISTS); $note_content = Common::filterText($note_content); if (Common::isPost()) { if ($note_content == "") { OSAdmin::alert("error", ErrorMessage::NEED_PARAM); } else { $note_content = htmlspecialchars($note_content); $input_data = array('note_content' => $note_content, 'owner_id' => UserSession::getUserId()); $note_id = QuickNote::addNote($input_data); if ($note_id) { SysLog::addLog(UserSession::getUserName(), 'ADD', 'QuickNote', $note_id, json_encode($input_data)); Common::exitWithSuccess('便签添加成功', 'panel/quicknote_add.php'); } } } Template::assign("_POST", $_POST); Template::display('panel/quicknote_add.tpl');