public function index(User $user, $type = null) { if (!Entrust::can('manage_user')) { return redirect('/dashboard')->withErrors(config('constants.NA')); } $query = $user->with('roles'); if ($type != null) { $query->whereHas('roles', function ($qry) use($type) { $qry->where('name', '=', $type); }); } $users = $query->get(); $col_data = array(); $col_heads = array(trans('messages.Option'), trans('messages.Name'), trans('messages.Username'), trans('messages.Email'), trans('messages.Department'), trans('messages.Role')); $col_heads = Helper::putCustomHeads($this->form, $col_heads); $col_ids = Helper::getCustomColId($this->form); $values = Helper::fetchCustomValues($this->form); $token = csrf_token(); foreach ($users as $user) { foreach ($user->roles as $role) { $role_name = $role->display_name; } $cols = array('<div class="btn-group btn-group-xs">' . '<a href="/user/' . $user->id . '" class="btn btn-default btn-xs" data-toggle="tooltip" title="View"> <i class="fa fa-share"></i></a> ' . '<a href="/user/welcomeEmail/' . $user->id . '/' . $token . '" class="btn btn-default btn-xs" data-toggle="tooltip" title="Send Welcome Email"> <i class="fa fa-envelope"></i></a>' . '<a href="/user/' . $user->id . '/edit" class="btn btn-default btn-xs" data-toggle="tooltip" title="Edit"> <i class="fa fa-edit"></i></a> ' . delete_form(['user.destroy', $user->id]) . '</div>', $user->name, $user->username, $user->email, $user->Profile->department_id != null ? $user->Profile->Department->department_name : '', $role_name); $id = $user->id; foreach ($col_ids as $col_id) { array_push($cols, isset($values[$id][$col_id]) ? $values[$id][$col_id] : ''); } $col_data[] = $cols; } Helper::writeResult($col_data); return view('user.index', compact('col_heads')); }
public function index(Annoucement $annoucement) { if (!Entrust::can('manage_annoucement')) { return redirect('/dashboard')->withErrors(config('constants.NA')); } $annoucements = $annoucement->get(); $col_data = array(); $col_heads = array(trans('messages.Option'), trans('messages.Title'), trans('messages.Scope'), trans('messages.Start Date'), trans('messages.End Date')); $col_heads = Helper::putCustomHeads($this->form, $col_heads); $col_ids = Helper::getCustomColId($this->form); $values = Helper::fetchCustomValues($this->form); foreach ($annoucements as $annoucement) { $role_name = "<ol class='nl'>"; foreach ($annoucement->Role as $role) { $role_name .= "<li>{$role->display_name}</li>"; } $role_name .= "</ol>"; $cols = array('<div class="btn-group btn-group-xs">' . '<a href="annoucement/' . $annoucement->id . '/edit" class="btn btn-default btn-xs" data-toggle="tooltip" title="Edit"> <i class="fa fa-edit"></i></a> ' . delete_form(['annoucement.destroy', $annoucement->id]) . '</div>', $annoucement->annoucement_title, $role_name, Helper::showDate($annoucement->start_date), Helper::showDate($annoucement->end_date)); $id = $annoucement->id; foreach ($col_ids as $col_id) { array_push($cols, isset($values[$id][$col_id]) ? $values[$id][$col_id] : ''); } $col_data[] = $cols; } Helper::writeResult($col_data); return view('annoucement.index', compact('col_heads')); }
/** * Snippet for displaying node default content options * * @param Node $node * @param string $header * @param bool $table * @return string */ public function nodeOptions(Node $node, $header = null, $table = true) { $id = $node->getKey(); $sourceId = $node->translateOrFirst()->getKey(); $html = ''; if ($node->canHaveChildren()) { $html .= '<li class="dropdown-sub__item"> <a href="' . route('reactor.nodes.create', $id) . '"> <i class="icon-plus"></i>' . trans('nodes.add_child') . '</a> </li> <li class="dropdown-sub__splitter"></li>'; } $html .= '<li class="dropdown-sub__item"> <a href="' . route('reactor.nodes.edit', [$id, $sourceId]) . '"> <i class="icon-pencil"></i>' . trans('nodes.edit') . '</a> </li>'; if ($node->canHaveMoreTranslations()) { $html .= '<li class="dropdown-sub__item"> <a href="' . route('reactor.nodes.translation.create', [$id, $sourceId]) . '"> <i class="icon-language"></i>' . trans('general.add_translation') . '</a> </li>'; } $html .= '<li class="dropdown-sub__item dropdown-sub__item--delete">' . delete_form(route('reactor.nodes.destroy', $id), trans('nodes.destroy')) . '</li> <li class="dropdown-sub__splitter"></li> <li class="dropdown-sub__item">' . $this->nodeOptionForm($node->isPublished() ? route('reactor.nodes.unpublish', $id) : route('reactor.nodes.publish', $id), $node->isPublished() ? 'icon-status-withheld' : 'icon-status-published', $node->isPublished() ? 'nodes.unpublish' : 'nodes.publish') . '</li> <li class="dropdown-sub__item">' . $this->nodeOptionForm($node->isLocked() ? route('reactor.nodes.unlock', $id) : route('reactor.nodes.lock', $id), $node->isLocked() ? 'icon-status-unlocked' : 'icon-status-locked', $node->isLocked() ? 'nodes.unlock' : 'nodes.lock') . '</li>'; return content_options_open($header, $table) . $html . content_options_close($table); }
public function index(CustomField $custom_field) { if (!Entrust::can('manage_custom_field')) { return redirect('/dashboard')->withErrors(config('constants.NA')); } $custom_fields = $custom_field->get(); $col_data = array(); $col_heads = array(trans('messages.Form'), trans('messages.Field Title'), trans('messages.Field Type'), trans('messages.Field Value'), trans('messages.Required'), trans('messages.Option')); foreach ($custom_fields as $custom_field) { $col_data[] = array(Helper::toWord($custom_field->form), $custom_field->field_title, $custom_field->field_type, implode('<br />', explode(',', $custom_field->field_values)), $custom_field->field_required ? 'Yes' : 'No', delete_form(['custom_field.destroy', $custom_field->id])); } Helper::writeResult($col_data); $data = ['col_heads' => $col_heads]; return view('custom_field.index', $data); }
public function index() { if (!Entrust::can('manage_language')) { return redirect('/dashboard')->withErrors(config('constants.NA')); } $languages = Helper::getAllLanguages(); $translation_count = count(Helper::getTranslationWords()); $token = csrf_token(); $col_data = array(); $col_heads = array(trans('messages.Option'), trans('messages.Locale'), trans('messages.Language Name'), trans('messages.Percentage Translation')); foreach ($languages as $key => $language) { $trans = File::getRequire(base_path() . '/resources/lang/' . $key . '/messages.php'); $percentage = $translation_count ? round(count($trans) * 100 / $translation_count, 2) : 0; $col_data[] = array('<div class="btn-group btn-group-xs">' . '<a href="/language/' . $key . '/edit" class="btn btn-default btn-xs md-trigger"> <i class="fa fa-edit"></i></a> ' . '<a href="/language/' . $key . '" class="btn btn-default btn-xs md-trigger"> <i class="fa fa-eye"></i></a> ' . delete_form(['language.destroy', $key]) . '</div>', $key, $language, $percentage . " % translation"); } Helper::writeResult($col_data); return view('language.index', compact('col_heads')); }
public function index(Page $page) { if (!Entrust::can('manage_page')) { return redirect('/dashboard')->withErrors(config('constants.NA')); } $pages = $page->get(); $col_data = array(); $col_heads = array(trans('messages.Option'), trans('messages.Title'), trans('messages.Published'), trans('messages.Sign-in Only')); $col_heads = Helper::putCustomHeads($this->form, $col_heads); $col_ids = Helper::getCustomColId($this->form); $values = Helper::fetchCustomValues($this->form); foreach ($pages as $page) { $cols = array('<div class="btn-group btn-group-xs">' . '<a href="page/' . $page->id . '/edit" class="btn btn-default btn-xs" data-toggle="tooltip" title="Edit"> <i class="fa fa-edit"></i></a> ' . delete_form(['page.destroy', $page->id]) . '</div>', $page->page_title, $page->published ? '<span class="badge badge-success">Publised</span>' : '<span class="badge badge-danger">Hold</span>', $page->sign_in_only ? '<span class="badge badge-warning">Sign-in Only</span>' : '<span class="badge badge-info">All</span>'); $id = $page->id; foreach ($col_ids as $col_id) { array_push($cols, isset($values[$id][$col_id]) ? $values[$id][$col_id] : ''); } $col_data[] = $cols; } Helper::writeResult($col_data); return view('page.index', compact('col_heads')); }
public function index(Holiday $holiday) { if (!Entrust::can('manage_holiday')) { return redirect('/dashboard')->withErrors(config('constants.NA')); } $holidays = Holiday::all(); $col_data = array(); $col_heads = array(trans('messages.Option'), trans('messages.Date'), trans('messages.Description')); $col_heads = Helper::putCustomHeads($this->form, $col_heads); $col_ids = Helper::getCustomColId($this->form); $values = Helper::fetchCustomValues($this->form); foreach ($holidays as $holiday) { $cols = array('<div class="btn-group btn-group-xs">' . '<a href="/holiday/' . $holiday->id . '/edit" class="btn btn-default btn-xs"> <i class="fa fa-edit"></i></a> ' . delete_form(['holiday.destroy', $holiday->id]) . '</div>', Helper::showDate($holiday->date), $holiday->holiday_description); $id = $holiday->id; foreach ($col_ids as $col_id) { array_push($cols, isset($values[$id][$col_id]) ? $values[$id][$col_id] : ''); } $col_data[] = $cols; } Helper::writeResult($col_data); $assets = ['mutidatepicker']; $data = ['col_heads' => $col_heads, 'assets' => $assets]; return view('holiday.index', $data); }
* Visit http://www.ChronoEngine.com for regular updates and information. **/ /* ensure that this file is not called from another file */ defined('_JEXEC') or die('Restricted access'); require_once JApplicationHelper::getPath('admin_html'); require_once JApplicationHelper::getPath('class'); //clean the $_POST data $_POST = JRequest::get('post', JREQUEST_ALLOWRAW); // case differentiation switch ($task) { case "form_wizard": case "apply_wizard_changes": form_wizard($task); break; case "remove": delete_form(); break; case "copy": copy_form(); break; case "add": case "edit": edit_form(); break; case "save": case "apply": save_form($task); break; case "create_table": case "save_table": create_table($task);
public function index(Ticket $ticket, Request $request) { if (!Entrust::can('manage_ticket')) { return redirect('/dashboard')->withErrors(config('constants.NA')); } if (Entrust::hasRole('admin')) { $query = $ticket::with('assignedUser'); } else { $query = $ticket::with('assignedUser')->whereHas('assignedUser', function ($query) { $query->where('user_id', '=', Auth::user()->id); }); } if ($request->input('department_id')) { $query->where('department_id', '=', $request->input('department_id')); } if ($request->input('ticket_type_id')) { $query->where('ticket_type_id', '=', $request->input('ticket_type_id')); } if ($request->input('ticket_priority')) { $query->where('ticket_priority', '=', $request->input('ticket_priority')); } if ($request->input('ticket_status')) { $query->where('ticket_status', '=', $request->input('ticket_status')); } if ($request->input('response_time_overdue')) { $query->where('response_due_time', '<', date('d M Y, H:i')); } if ($request->input('resolution_time_overdue')) { $query->where('resolution_due_time', '<', date('d M Y, H:i')); } if ($request->input('start_date')) { $query->where('created_at', '>=', $request->input('start_date')); } if ($request->input('end_date')) { $query->where('created_at', '<=', $request->input('end_date')); } if ($request->input('assigned') == 'assigned') { $query->Has('assignedUser'); } elseif ($request->input('assigned') == 'unassigned') { $query->doesntHave('assignedUser'); } if ($request->input('user_id')) { $query->whereHas('assignedUser', function ($query1) use($request) { $query1->whereIn('user_id', $request->input('user_id')); }); } $filter_data = ['start_date' => $request->input('start_date'), 'end_date' => $request->input('end_date'), 'assigned' => $request->input('assigned'), 'department_id' => $request->input('department_id'), 'ticket_type_id' => $request->input('ticket_type_id'), 'ticket_priority' => $request->input('ticket_priority'), 'ticket_status' => $request->input('ticket_status'), 'user_id' => $request->input('user_id'), 'response_time_overdue' => $request->input('response_time_overdue'), 'resolution_time_overdue' => $request->input('resolution_time_overdue')]; $tickets = $query->get(); $col_data = array(); $col_heads = array(trans('messages.Option'), trans('messages.Ticket #'), trans('messages.Name'), trans('messages.Subject'), trans('messages.Response Time'), trans('messages.Resolution Time'), trans('messages.Priority'), trans('messages.Status')); $col_heads = Helper::putCustomHeads($this->form, $col_heads); $col_ids = Helper::getCustomColId($this->form); $values = Helper::fetchCustomValues($this->form); foreach ($tickets as $ticket) { $cols = array('<div class="btn-group btn-group-xs">' . '<a href="/ticket/' . $ticket->id . '" class="btn btn-default btn-xs" data-toggle="tooltip" title="View"> <i class="fa fa-share"></i></a> ' . '<a href="/ticket/' . $ticket->id . '/edit" class="btn btn-default btn-xs" data-toggle="tooltip" title="Edit"> <i class="fa fa-edit"></i></a> ' . delete_form(['ticket.destroy', $ticket->id]) . '</div>', $ticket->ticket_no, $ticket->User->name, $ticket->ticket_subject, (strtotime($ticket->response_due_time) < time() ? '<span class="badge badge-danger">Overdue</span> ' : '') . Helper::showDateTime($ticket->response_due_time), (strtotime($ticket->resolution_due_time) < time() ? '<span class="badge badge-danger">Overdue</span> ' : '') . Helper::showDateTime($ticket->resolution_due_time), Helper::showTicketPriority($ticket->ticket_priority), Helper::showTicketStatus($ticket->ticket_status)); $id = $ticket->id; foreach ($col_ids as $col_id) { array_push($cols, isset($values[$id][$col_id]) ? $values[$id][$col_id] : ''); } $col_data[] = $cols; } $departments = Department::lists('department_name', 'id')->all(); $ticket_types = TicketType::lists('ticket_type_name', 'id')->all(); Helper::writeResult($col_data); $users = User::with('roles')->whereHas('roles', function ($query) { $query->where('roles.name', '!=', 'user'); })->lists('name', 'id')->all(); return view('ticket.index', compact('col_heads', 'departments', 'ticket_types', 'filter_data', 'users')); }
function deleteModel($title, $var, $route, $id, $model = "myModal", $url) { ?> <a class="btn btn-sm btn-danger" type="button" data-toggle="modal" data-target="#<?php echo $model; ?> " ><i data-toggle="tooltip" title="حذف" class="fa fa-trash fa-lg"></i></a> <div class="modal fade" id="<?php echo $model; ?> " tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel"><?php echo trans('general.delete'); ?> <small> <?php echo $title; ?> </small></h4> </div> <div class="modal-body"> <h3> <?php echo trans('validation.delete_question'); ?> </h3> </div> <div class="modal-footer"> <div id="deleteTheItem" class="pull-right"> <?php echo delete_form($var, $route, $id, $model, $url); ?> </div> <span class="pull-right" style="padding-right:10px;"> <button type="button" class="btn btn-info" data-dismiss="modal"> <?php echo trans('general.no'); ?> </button> </span> </div> </div> </div> </div> <?php }
<?php session_start(); header("Cache-Control: private, no-cache, must-revalidate"); require "library.php"; $request = array_merge($_POST, $_GET); $form_id = $request["form_id"]; delete_form($form_id); ?>
/** * Snippet for displaying standard content options * * @param string $key * @param int $id * @return string */ public function contentOptions($key, $id) { $html = '<li class="dropdown-sub__item"> <a href="' . route('reactor.' . $key . '.edit', $id) . '"> <i class="icon-pencil"></i>' . trans($key . '.edit') . '</a> </li> <li class="dropdown-sub__item dropdown-sub__item--delete">' . delete_form(route('reactor.' . $key . '.destroy', $id), trans($key . '.destroy')) . '</li>'; return $this->contentOptionsOpen() . $html . $this->contentOptionsClose(); }
function _moduleContent(&$smarty, $module_name) { //include module files include_once "modules/{$module_name}/configs/default.conf.php"; global $arrConf; $arrConf['cadena_dsn'] = "mysql://*****:*****@localhost/hispana"; // _pre($arrConf); // _pre($_SESSION); /* global $arrLang; #incluir el archivo de idioma de acuerdo al que este seleccionado #si el archivo de idioma no existe incluir el idioma por defecto $lang=get_language(); $script_dir=dirname($_SERVER['SCRIPT_FILENAME']); // Include language file for EN, then for local, and merge the two. include_once("modules/$module_name/lang/en.lang"); $lang_file="modules/$module_name/lang/$lang.lang"; if (file_exists("$script_dir/$lang_file")) { $arrLangModuleEN = $arrLangModule; include_once($lang_file); $arrLangModule = array_merge($arrLangModuleEN, $arrLangModule); } */ load_language_module($module_name); require_once "modules/{$module_name}/libs/paloSantoDataForm.class.php"; //folder path for custom templates $base_dir = dirname($_SERVER['SCRIPT_FILENAME']); $templates_dir = isset($arrConfig['templates_dir']) ? $arrConfig['templates_dir'] : 'themes'; $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme']; // Definición del formulario de nueva formulario $smarty->assign("MODULE_NAME", $module_name); $smarty->assign("REQUIRED_FIELD", _tr('Required field')); $smarty->assign("CANCEL", _tr('Cancel')); $smarty->assign("APPLY_CHANGES", _tr('Apply changes')); $smarty->assign("SAVE", _tr('Save')); $smarty->assign("EDIT", _tr('Edit')); $smarty->assign("DESCATIVATE", _tr('Desactivate')); $smarty->assign("DELETE", _tr('Delete')); $smarty->assign("CONFIRM_CONTINUE", _tr('Are you sure you wish to continue?')); $smarty->assign("new_field", _tr('New Field')); $smarty->assign("add_field", _tr('Add Field')); $smarty->assign("update_field", _tr('Update Field')); $smarty->assign("CONFIRM_DELETE", _tr('Are you sure you wish to delete form?')); //Definicion de campos $formCampos = array('form_nombre' => array("LABEL" => _tr('Form Name'), "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => array("size" => "60"), "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), 'form_description' => array("LABEL" => _tr('Form Description'), "REQUIRED" => "no", "INPUT_TYPE" => "TEXTAREA", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "", "COLS" => "33", "ROWS" => "2"), 'field_nombre' => array("LABEL" => _tr('Field Name'), "REQUIRED" => "yes", "INPUT_TYPE" => "TEXTAREA", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "", "COLS" => "50", "ROWS" => "2"), "order" => array("LABEL" => _tr('Order'), "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => array("size" => "3"), "VALIDATION_TYPE" => "numeric", "VALIDATION_EXTRA_PARAM" => "")); $smarty->assign("type", _tr('Type')); $smarty->assign("select_type", "type"); $arr_type = array("VALUE" => array("TEXT", "LIST", "DATE", "TEXTAREA", "LABEL"), "NAME" => array(_tr('Type Text'), _tr('Type List'), _tr('Type Date'), _tr('Type Text Area'), _tr('Type Label')), "SELECTED" => "TEXT"); $smarty->assign("option_type", $arr_type); $smarty->assign("item_list", _tr('List Item')); $smarty->assign("agregar", _tr('Add Item')); $smarty->assign("quitar", _tr('Remove Item')); $oForm = new paloForm($smarty, $formCampos); // print_r($_SESSION['ayuda']); $xajax = new xajax(); $xajax->registerFunction("agregar_campos_formulario"); $xajax->registerFunction("cancelar_formulario_ingreso"); $xajax->registerFunction("guardar_formulario"); $xajax->registerFunction("eliminar_campos_formulario"); $xajax->registerFunction("editar_campo_formulario"); $xajax->registerFunction("update_campo_formulario"); $xajax->registerFunction("cancel_campo_formulario"); $xajax->registerFunction("desactivar_formulario"); $xajax->processRequests(); $smarty->assign("xajax_javascript", $xajax->printJavascript("libs/xajax/")); $pDB = new paloDB($arrConf['cadena_dsn']); if (!is_object($pDB->conn) || $pDB->errMsg != "") { $smarty->assign("mb_message", _tr('Error when connecting to database') . " " . $pDB->errMsg); } if (isset($_POST['submit_create_form'])) { $contenidoModulo = new_form($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm); } else { if (isset($_POST['edit'])) { $contenidoModulo = edit_form($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm); } else { if (isset($_POST['delete'])) { $contenidoModulo = delete_form($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm); } else { if (isset($_GET['id']) && isset($_GET['action']) && $_GET['action'] == "view") { $contenidoModulo = view_form($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm); } else { if (isset($_GET['id']) && isset($_GET['action']) && $_GET['action'] == "activar") { $contenidoModulo = activar_form($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm); } else { if (isset($_GET['id']) && isset($_GET['action']) && $_GET['action'] == "editarCampo") { $contenidoModulo = editar_campo_status($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm); } else { $contenidoModulo = listadoForm($pDB, $smarty, $module_name, $local_templates_dir); } } } } } } return $contenidoModulo; }
/** * Generate a themed delete confirmation form. * * @param $type The type of element to delete. * @param $id The id of the element to delete. * @return The themed html for a delete confirmation form. */ function theme_delete_form($type, $id) { return theme('form', delete_form($type, $id)); }