if (move_uploaded_file($_FILES['icon_file']['tmp_name'], $uploadfile)) { } else { } $data = array('title' => $input['title'], 'url' => $input['url'], 'sort_order' => 0, 'img_path' => $web_file_path); $new_id = $db->insert('link_list', $data); if ($new_id <= 0) { $alert_output = $message->alert_dialog('Could not add new link.'); } } } } /***** * Display logic */ $list->row_class('link'); $list->sort_by('link'); $list->draggable(true); $delete_link = new GrlxLinkStyle(); $delete_link->i_only(true); $delete_link->action('delete'); $edit_link = new GrlxLinkStyle(); $edit_link->url('site.link-edit.ajax.php'); $edit_link->reveal(true); $edit_link->action('edit'); // Fetch the link list $cols = array('title', 'url', 'sort_order', 'img_path', 'id'); $result = $db->orderBy('sort_order', 'ASC')->get('link_list', NULL, $cols); if ($db->count > 0) { foreach ($result as $item) { if ($item['img_path']) { $icon = '<img src="' . $item['img_path'] . '" alt="icon" />';
// Check for duplicate paths if ($path_items) { $dupe_check = array_count_values($path_items); foreach ($dupe_check as $key => $val) { if ($val > 1) { $dupes[] = $key; } } } if (isset($dupes)) { $dupe_alert_output = $message->alert_dialog('Duplicates detected! You should create unique path names to avoid problems.'); } // Build output if ($nav_item) { $list->row_class('menu'); $list->sort_by('menu'); $list->draggable(true); $form->title('Show/hide this item in the site menu.'); $vis_link = new GrlxLinkStyle(); $vis_link->i_only(true); $edit_link = new GrlxLinkStyle(); $edit_link->url('site.nav-edit.ajax.php'); $edit_link->title('Change this item’s tappable text or destination URL.'); $edit_link->reveal(true); $edit_link->action('edit'); foreach ($nav_item as $item) { $edit_link->query("edit_id={$item['id']}"); if ($item['rel_type'] == 'external') { $vis_link->action('delete'); $vis_link->id("delete-{$item['id']}"); $vis_link->title('Delete this link from your site’s menu.');