$user_id = get_entry('access_keys', 'account_id', 'key_id', $key, $db); } else { $user_id = $_SESSION['user']['account_id']; } $statement_id = $_REQUEST['statement_id']; $statement_info = URIinfo('S' . $statement_id, $user_id, $key, $db); if (!$statement_info['delete']) { echo "User cannot delete this statement"; exit; } else { $project_info = get_info('project', $statement_info['project_id'], $db); $instance_info = get_info('instance', $statement_info['resource_id'], $db); $statements[0] = $statement_info; $statements = include_rule_info($statements, $project_id, $db); $statements = include_button_notes($statements, $project_id, $db); $statements = Values2Links($statements); $statement_info = $statements[0]; #echo '<pre>';print_r($statement_info); if ($_POST['delete_statement'] != '') { $s3ql = compact('db', 'user_id'); $s3ql['delete'] = 'statement'; $s3ql['where']['statement_id'] = $statement_id; $s3ql['flag'] = 'all'; #$s3ql['format']='html'; #$s3ql['where']['project_id'] = $project_id; #$s3ql['where']['confirm'] = 'yes'; $done = S3QLaction($s3ql); $done = html2cell($done); #echo '<pre>';print_r($done); #ereg('<error>([0-9]+)</error>.*<message>(.*)</message>', $done, $s3qlout); if ($done[2]['error_code'] == '0') {
function render_datamatrix_values($vals) { $action = $GLOBALS['webaction']; extract($vals); $color = $_REQUEST['color']; $format = $_REQUEST['format']; $parser = get_parser_characters($format); $rows = ''; $items = $instances; // if($_REQUEST['num_per_page']!='' && $_REQUEST['current_page']!='') // { // $start = (($_REQUEST['current_page']-1)*$_REQUEST['num_per_page']); // $end=($_REQUEST['num_per_page']*$_REQUEST['current_page']); // } // else { // $start = 0; // $end= count($items); // } #if(is_array($matched_resource)) for ($i = $start; $i < $end; $i++) { $item_id = $items[$i]['item_id']; if (!is_array($items[$i]['stats'])) { $row = ''; $s3ql = compact('db', 'user_id'); $s3ql['select'] = '*'; $s3ql['from'] = 'statements'; $s3ql['where']['item_id'] = $item_id; $all_values = S3QLaction($s3ql); } else { $all_values = $items[$i]['stats']; } #echo '<pre>';print_r($all_values);exit; if (is_array($all_values) && !empty($all_values)) { #replace values with filelinks and find the notes for the buttons $all_values = include_button_notes($all_values, $project_id, $db); $all_values = Values2Links($all_values); } if (count($all_values) == '0') { if ($color == 'on') { if ($total % 2 == 0) { $row = sprintf("%s\n", ' <tr bgcolor="AliceBlue">'); } else { $row = sprintf("%s\n", $parser['tr']); } #$all_values = include_button_notes($all_values, $project_id, $db); #In case color is on, it means we are trying to achieve one of the interactive, user-friendly interfaces. Therefore, resource should come in the format of a button. Need to be dealt with care in case $resource_id_button = '<input type="button" size="10" value="' . str_pad($item_id, 6, '0', STR_PAD_LEFT) . '" onClick="window.open(\'' . $action['item'] . '&item_id=' . $item_id . '\', \'_blank\', \'width=700, height=600, location=no, titlebar=no, scrollbars=yes, resizable=yes\')">'; } else { $resource_id_button = $item_id; } $subrow = ''; $subrow .= sprintf("%s", $parser['td'] . $resource_id_button . $parser['end_td']); $subrow .= sprintf("%s", $parser['td'] . $items[$i]['notes'] . $parser['end_td']); #Moving on to the data on the rules, since there are no values on this row, print only opening and ending the cell if (is_array($rules)) { foreach ($rules as $j => $value) { $subrow .= sprintf("%s", $parser['td'] . $parser['end_td']); } } $subrow .= sprintf("%s", $parser['end_tr']); $row .= $subrow; $total += 1; } else { $n = get_max_num_values($all_values, $rules) == 0 ? 1 : get_max_num_values($all_values, $rules); #$n will determine the number of lines for this item $total = 0; $row = ''; for ($m = 0; $m < $n; $m++) { //$row =''; if ($_REQUEST['color'] == 'on') { #if($total%2==0) #$row .=sprintf("%s\n", '<tr bgcolor="AliceBlue">');} #else #$row .=sprintf("%s\n", $parser['tr']); $resource_id_button = '<input type="button" size="10" value="' . str_pad($item_id, 6, '0', STR_PAD_LEFT) . '" onClick="window.open(\'' . $action['item'] . '&item_id=' . $item_id . '\', \'_blank\', \'width=700, height=600, location=no, titlebar=no, scrollbars=yes, resizable=yes\')">'; } else { $resource_id_button = $item_id; } $row .= sprintf("%s", $parser['tr']); $subrow = ''; $subrow .= sprintf("%s", $parser['td'] . $resource_id_button . $parser['end_td']); $subrow .= sprintf("%s", $parser['td'] . $items[$i]['notes'] . $parser['end_td']); #if($item_id=='3783'){ echo $row ; exit;} //print_r($rules); if (is_array($rules)) { foreach ($rules as $j => $value) { $rule_id = $rules[$j]['rule_id']; $values = get_value_by_rule($all_values, $rule_id); if ($format == 'html' && $color == 'on') { $value = viewStatementValue($values[$m]); } else { $value = $values[$m]['value']; } if ($value != '') { $subrow .= sprintf("%s", $parser['td'] . $value . $parser['end_td']); } else { $subrow .= sprintf("%s", $parser['td'] . $parser['end_td']); } } } $subrow .= sprintf($parser['end_tr']); $row .= $subrow; } $rows .= $row; } } $rows .= sprintf($parser['end_table']); return $rows; }
exit; } if ($rule_id != '' && !$rule_info['view']) { echo "User does not have access to this project"; exit; } $s3ql = compact('db', 'user_id'); if ($rule_info != '') { $s3ql['select'] = '*'; $s3ql['from'] = 'statements'; $s3ql['where']['rule_id'] = $rule_info['rule_id']; #$s3ql['where']['project_id'] = $project_id; $data = S3QLaction($s3ql); if (is_array($data)) { #$data = include_rule_info($data, $project_id, $db); $data = Values2Links($data); $data = array_unique(array_map('grab_value', $data)); if ($rule_info['object_id'] != '') { ##add the notes in the values foreach ($data as $Item_id) { $sql = "select notes from s3db_resource where resource_id = '" . $Item_id . "'"; $db->query($sql, __LINE__, __FILE__); if ($db->next_record()) { $notes = $db->f('notes'); } else { $notes = ''; } $itemData[] = array('resource_id' => $Item_id, 'notes' => $notes); } $data = $itemData; }