function action_post_manage_user_bot($params) { global $_ACTION; print_r($_POST); if (user()->right() == 'ADMIN') { $delete = array(); $insert = array(); $user = USER::byID($params['values']['user']); foreach ($params['values']['bots'] as $id) { if (!in_array($id, $params['values_old']['bots'])) { $user->add_bot($id); } } foreach ($params['values_old']['bots'] as $id) { if (!in_array($id, $params['values']['bots'])) { $user->delete_bot($id); } } if ($user->id() == user()->id()) { user()->bots(true); } header('Location: ' . action_url($_ACTION['manage_user_bot'], 'get', array('values' => array($params['values']['user']))) . '#user_' . $params['values']['ancre']); die; } }
function action_url_a($uri, $link_name, $title = "", $css_class = "") { $url = action_url($uri); if ($title == "") { $title = $link_name; } echo '<a class="vietnamese_english ' . $css_class . '" href="' . $url . '" title="' . $title . '" >' . $link_name . "</a>"; }
/** * @Decorated */ public function save() { $id = $this->request->param('id', TRUE, 0); $this->mc2ads_advertiser_model->save($id); $data['status'] = 'save_ok'; $data['redirect_url'] = action_url('mc2ads_advertiser/manage/'); $this->load->view('mc2ads/success', $data); }
function get_table_data($start = 0, $limit = 100) { $this->db->order_by("creation_time", "desc"); $query = $this->db->get(self::TABLE, $limit, $start); $data = array(); if ($query->num_rows() > 0) { $data[] = array('ID', 'Tên', 'Nội dung chi tiết', 'Chức năng'); foreach ($query->result() as $row) { $editUrl = '<a href="' . action_url('mc2ads_advertiser/edit/' . $row->id) . '">Cập nhật</a>'; $actions = '<div>' . $editUrl . '</div>'; $data[] = array($row->id, '<p style="font-weight:bold;">' . $row->name . '</p>', '<div id="advertiser_des" style="width:650px">' . $row->description . '</div>', $actions); } } return $data; }
function get_table_data($start = 0, $limit = 100) { $this->db->order_by("creation_time", "desc"); $query = $this->db->get(self::TABLE, $limit, $start); $data = array(); if ($query->num_rows() > 0) { $data[] = array('ID', 'Tiêu đề', 'Nội dung chi tiết', 'Hình', 'Thời gian tạo', 'Số lần click xem', 'Chức năng'); foreach ($query->result() as $row) { $editUrl = '<a class="action" href="' . action_url('mc2ads/edit/' . $row->id) . '">Cập nhật</a>'; $actions = '<div>' . $editUrl . '<br><br><a class="action" href="' . action_url('mc2ads/delete/' . $row->id) . '">Xóa</a></div>'; $img = '<img style="max-width:100px;max-height:100px;" src="' . base_url() . str_replace('./', '', $row->image_url) . '" />'; $data[] = array($row->id, '<p style="font-weight:bold;">' . $row->title . '</p>', '<p style="width:450px">' . $row->description . '</p>', $img, date('d/m/Y', $row->creation_time), '<p class="ads_counter">' . $row->view_count . '</p>', $actions); } } return $data; }
/** * delete a command * * @param $id * @return mixed */ public function deleteSchedule($id) { \ruler()->check($this->permission, ['id' => 'required|exists:schedule,schedule_id'], ['id' => $id]); // Récuperation du model $schedule = Schedule::find($id); $modal = \modal(null, 'Etes vous sûr de vouloir supprimer : <b>' . $schedule->schedule_id . '</b>'); $button = (new \FrenchFrogs\Form\Element\Button('yes', 'Supprimer !'))->setOptionAsDanger()->enableCallback('delete')->addAttribute('href', action_url(static::class, __FUNCTION__, $id, ['delete' => true])); $modal->appendAction($button); // enregistrement if (\request()->has('delete')) { try { $schedule->delete(); \js()->success()->closeRemoteModal()->reloadDataTable(); } catch (\Exception $e) { \js()->error($e->getMessage()); } return \js(); } return response()->modal($modal); }
function smarty_function_action($params, &$smarty) { return action_url($params['action'], $params['type'], array_replace($params['params'], $params)); }
function get_table_row($filterinfo, $isfirstrow, $islastactive, $applytostrings) { global $CFG, $OUTPUT, $activechoices, $applytochoices, $filternames; $row = array(); $filter = $filterinfo->filter; // Filter name if (!empty($filternames[$filter])) { $row[] = $filternames[$filter]; } else { $row[] = '<span class="error">' . get_string('filemissing', '', $filter) . '</span>'; } // Disable/off/on $select = html_select::make_popup_form(action_url($filter, 'setstate'), 'newstate', $activechoices, 'active' . basename($filter), $filterinfo->active); $select->nothinglabel = false; $select->form->button->text = get_string('save', 'admin'); $row[] = $OUTPUT->select($select); // Re-order $updown = ''; $spacer = '<img src="' . $OUTPUT->old_icon_url('spacer') . '" class="iconsmall" alt="" /> '; if ($filterinfo->active != TEXTFILTER_DISABLED) { if (!$isfirstrow) { $updown .= action_icon(action_url($filter, 'up'), 'up', get_string('up')); } else { $updown .= $spacer; } if (!$islastactive) { $updown .= action_icon(action_url($filter, 'down'), 'down', get_string('down')); } else { $updown .= $spacer; } } $row[] = $updown; // Apply to strings. $select = html_select::make_popup_form(action_url($filter, 'setapplyto'), 'stringstoo', $applytochoices, 'applyto' . basename($filter), $applytostrings); $select->nothinglabel = false; $select->disabled = $filterinfo->active == TEXTFILTER_DISABLED; $select->form->button->text = get_string('save', 'admin'); $row[] = $OUTPUT->select($select); // Settings link, if required if (filter_has_global_settings($filter)) { $row[] = '<a href="' . $CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=filtersetting' . str_replace('/', '', $filter) . '">' . get_string('settings') . '</a>'; } else { $row[] = ''; } // Delete if (substr($filter, 0, 4) != 'mod/') { $row[] = '<a href="' . action_url($filter, 'delete') . '">' . get_string('delete') . '</a>'; } else { $row[] = ''; } return $row; }
/** * * Table de gestion des groupes * * @return \FrenchFrogs\Table\Table\Table */ public static function groups() { // QUERY $query = \query('user_group', [raw('HEX(id) as id'), 'name'])->whereNull('deleted_at')->orderBy('name'); // TABLE $table = \table($query); $table->setConstructor(static::class, __FUNCTION__)->enableRemote()->enableDatatable(); $table->useDefaultPanel('Groupes')->getPanel()->addButton('add', 'Ajouter', action_url(static::class, 'postGroup'))->setOptionAsPrimary()->enableRemote(); // COLMUMN $table->addText('name', 'Nom')->setStrainerText('name'); // ACTION $action = $table->addContainer('action', 'Action')->right(); $action->addButtonEdit(action_url(static::class, 'postGroup', '%s'), 'id'); $action->addButtonDelete(action_url(static::class, 'deleteGroup', '%s'), 'id'); return $table; }
function get_table_row($filterinfo, $isfirstrow, $islastactive, $applytostrings) { global $CFG, $activechoices, $applytochoices, $filternames; $row = array(); $filter = $filterinfo->filter; // Filter name if (!empty($filternames[$filter])) { $row[] = $filternames[$filter]; } else { $row[] = '<span class="error">' . get_string('filemissing', '', $filter) . '</span>'; } // Disable/off/on $row[] = popup_form(action_url($filter, 'setstate') . '&newstate=', $activechoices, 'active' . basename($filter), $filterinfo->active, '', '', '', true, 'self', '', NULL, get_string('save', 'admin')); // Re-order $updown = ''; $spacer = '<img src="' . $CFG->pixpath . '/spacer.gif" class="iconsmall" alt="" /> '; if ($filterinfo->active != TEXTFILTER_DISABLED) { if (!$isfirstrow) { $updown .= action_icon(action_url($filter, 'up'), 'up', get_string('up')); } else { $updown .= $spacer; } if (!$islastactive) { $updown .= action_icon(action_url($filter, 'down'), 'down', get_string('down')); } else { $updown .= $spacer; } } $row[] = $updown; // Apply to strings. $row[] = popup_form(action_url($filter, 'setapplyto') . '&stringstoo=', $applytochoices, 'applyto' . basename($filter), $applytostrings, '', '', '', true, 'self', '', NULL, get_string('save', 'admin'), $filterinfo->active == TEXTFILTER_DISABLED); // Settings link, if required if (filter_has_global_settings($filter)) { $row[] = '<a href="' . $CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=filtersetting' . str_replace('/', '', $filter) . '">' . get_string('settings') . '</a>'; } else { $row[] = ''; } // Delete if (substr($filter, 0, 4) != 'mod/') { $row[] = '<a href="' . action_url($filter, 'delete') . '">' . get_string('delete') . '</a>'; } else { $row[] = ''; } return $row; }
public function world_borders($params = array()) { $this->EE->load->library('kml_api'); $params = array_merge(array('country_code' => FALSE, 'id' => 'map', 'asynchronous' => TRUE, 'options' => array('afterParse' => NULL, 'createOverlay' => NULL, 'createMarker' => NULL, 'failedParse' => NULL, 'processStyles' => FALSE, 'singleInfoWindow' => FALSE, 'suppressInfoWindows' => TRUE, 'zoom' => FALSE), 'extend_bounds' => TRUE, 'infobox' => FALSE, 'infowindow' => FALSE, 'style' => array('strokeWeight' => 1, 'strokeOpacity' => 0.5, 'strokeColor' => 'blue', 'fillOpacity' => 0.3, 'fillColor' => 'blue')), $params); if (!$params['country_code']) { return; } //$geoxml_options = json_encode($params['options']); $content = isset($params['infowindow']['content']) ? $params['infowindow']['content'] : NULL; $content = $content == NULL && isset($result->content) ? $this->EE->google_maps->clean_js($result->content) : $content; $show_one_window = isset($params['infowindow']['show_one_window']) ? $params['infowindow']['show_one_window'] : FALSE; $open_windows = isset($params['infowindow']['open_windows']) ? $params['infowindow']['open_windows'] : FALSE; if (isset($params['infobox']) && $params['infobox']) { $window = $this->EE->google_maps->infobox(array('id' => $params['id'], 'content' => $content, 'options' => $params['infowindow']['options'], 'script_tag' => FALSE, 'var' => $params['id'] . '_regions[index]', 'show_one_window' => $show_one_window, 'open_windows' => $open_windows, 'trigger' => $params['window_trigger'])); } else { $window = $this->EE->google_maps->infowindow(array('id' => $params['id'], 'content' => $content, 'options' => $params['infowindow']['options'], 'script_tag' => FALSE, 'var' => $params['id'] . '_regions[index]', 'show_one_window' => $show_one_window, 'open_windows' => $open_windows, 'trigger' => $params['window_trigger'])); } $this->EE->load->helper('addon'); if ($params['asynchronous']) { $params['options']['afterParse'] = 'function(docs) { var polygon = docs[0].gpolygons[0]; if(polygon) { ' . $params['id'] . '_bounds.union(polygon.getBounds()); polygon.setOptions(' . json_encode($params['style']) . '); ' . (!$params['extend_bounds'] && !$params['options']['zoom'] ? NULL : ' ' . $params['id'] . '_map.fitBounds(' . $params['id'] . '_bounds);') . ' ' . $params['id'] . '_regions.push(polygon); index = ' . $params['id'] . '_regions.length - 1; ' . $window . ' } }'; $kml = action_url('gmap', 'world_borders_action', FALSE) . '&country_code=' . $params['country_code']; } else { $country_border = $this->EE->kml_model->get_country_code($params['country_code']); $country_border = $country_border->row('geometry'); if (is_array($country_border)) { $country_border = NULL; } $kml = $this->EE->kml_api->prep_string($country_border, $params); } $geoxml_options = $this->convert_to_js($params['options']); $return = ' var index = ' . $params['id'] . '_regions.length; var options = ' . $geoxml_options . '; options.map = ' . $params['id'] . '_map; var geoXml = new geoXML3.parser(options); ' . (!$params['asynchronous'] ? ' geoXml.parseKmlString(\'' . $kml . '\'); if(geoXml.docs[0].gpolygons[0]) { ' . $params['id'] . '_bounds.union(geoXml.docs[0].gpolygons[0].getBounds()); geoXml.docs[0].gpolygons[0].setOptions(' . json_encode($params['style']) . '); ' . (!$params['extend_bounds'] && !$params['options']['zoom'] ? NULL : ' ' . $params['id'] . '_map.fitBounds(' . $params['id'] . '_bounds);') . ' ' . $params['id'] . '_regions.push(geoXml.docs[0].gpolygons[0]); index = ' . $params['id'] . '_regions.length - 1; ' . $window . ' }' : 'geoXml.parse(\'' . $kml . '\');') . ' '; $return = '<script type="text/javascript">' . $return . '</script>'; if (isset($params['script_tag'])) { $url = rtrim($this->EE->theme_loader->theme_url(), '/') . '/'; $return = ' <script type="text/javascript" src="' . rtrim($url, '/') . '/gmap/javascript/geoxml3.js"></script> ' . $return; } return $return; }
/** * @Decorated * @Secured(role = "administrator") */ public function delete($id) { $this->page_decorator->setPageTitle("Xóa thông tin Ad"); $this->mc2ads_model->delete($id); if ($id > 0) { $data['status'] = 'save_ok'; $this->mc2ads_model->delete($id); } else { $data['status'] = 'fail'; } $data['redirect_url'] = action_url('mc2ads/manage/'); $this->load->view('mc2ads/success', $data); }