<?php // BEGIN LIST DATA LOOP foreach ($list_data as $list) { $purchased_items = ""; $items_to_purchase = ""; $names_shared_with = ""; foreach ($item_data as $item) { if ($item['list_id'] === $list['list_id']) { if ($item['purchased'] == 0) { $items_to_purchase .= itemTemplate($item, $note_data); } else { if ($item['purchased'] == 1) { $purchased_items .= itemTemplate($item, $note_data); } } } } // end item loop // get names for who a list is shared with $pos = 0; for ($l = 0; $l < count($shared_list_data); $l++) { if ($shared_list_data[$l]['list_id'] === $list['list_id']) { for ($i = 0; $i < count($shared_lists_names); $i++) { if ($shared_list_data[$l]['viewer_id'] === $shared_lists_names[$i]['user_id']) { if ($pos == 0) { $names_shared_with .= $shared_lists_names[$i]['creator']; } else { $names_shared_with .= ", " . $shared_lists_names[$i]['creator']; } break;
require_once 'src/chainedSelectors.php'; //This is kludged to the max dude. if ($_GET['q'] && !$_POST['submit']) { $itemtemplate = itemTemplate($_GET['q']); $item_template = $itemtemplate[0]; $items = $itemtemplate[1]; $match = $_GET['q']; array2smarty($smarty, item2smartyvarmap(1), $items); $smarty->assign('javascriptonload', "onload='putFocus(0,10);'"); $subdept = deptDropDowns(); $smarty->assign('items', $items); $smarty->assign_by_ref('subdept', $subdept); $smarty->assign('buttontext', 'Update'); } if ($_POST['submit']) { $itemtemplate = itemTemplate($_POST['upc']); $item_template = $itemtemplate[0]; $items = $itemtemplate[1]; $match = $_POST['upc']; switch ($_POST['submit']) { case "Search": if (is_array($items) && $item_template == 'itemEdit.tpl') { //edit //setup variables $smarty->assign('javascriptonload', "onload='putFocus(0,10);'"); array2smarty($smarty, item2smartyvarmap(1), $items); $subdept = deptDropDowns(); $smarty->assign('items', $items); $salesbatch = selectSalesBatch($match); $smarty->assign('salesbatch', $salesbatch); $smarty->assign_by_ref('subdept', $subdept);
<?php foreach ($shared_lists_info as $list) { $purchased_items = ""; $items_to_purchase = ""; $names_shared_with = ""; $list['editable'] == 1 ? $is_editable = true : ($is_editable = false); foreach ($shared_item_info as $item) { if ($item['list_id'] === $list['list_id']) { if ($item['purchased'] == 0) { $items_to_purchase .= itemTemplate($item, $shared_note_data, $is_editable); } else { if ($item['purchased'] == 1) { $purchased_items .= itemTemplate($item, $shared_note_data, $is_editable); } } } // end if item } // end item loop $pos = 0; foreach ($shared_with_id as $shared_with) { for ($l = 0; $l < count($shared_with); $l++) { if ($shared_with[$l]['list_id'] === $list['list_id']) { for ($i = 0; $i < count($shared_with_names); $i++) { if ($shared_with[$l]['viewer_id'] === $shared_with_names[$i][0]['user_id']) { if ($pos == 0) { $names_shared_with .= $shared_with_names[$i][0]['creator']; } else { $names_shared_with .= ", " . $shared_with_names[$i][0]['creator']; }