function objectSocialLinePostAction($classname) { //when multi object is used in one page, //send array of classname with below format: //array('unique_identifier'=>'classname'); global $session_userinfo; if (isset($_POST['me_action']) && $_POST['me_action'] == 'SOCLINE') { $action = $_POST['sl_action']; $unique_identifier = $_POST['unique_identifier']; $obj_id = $_POST['id']; if (is_array($classname)) { $classname = $classname[$unique_identifier]; } eval('$object = new ' . $classname . '(' . $obj_id . ');'); switch ($action) { case 'FOLLOW': case 'UNFOLLOW': if (isset($object->followers) && is_object($object->followers)) { if ($action == 'FOLLOW') { $object->followers->addFollower($session_userinfo['id']); } else { $object->followers->deleteFollower($session_userinfo['id']); } } break; case 'LIKE': case 'UNLIKE': if (isset($object->likes) && is_object($object->likes)) { if ($action == 'LIKE') { $object->likes->addLike($session_userinfo['id']); } else { $object->likes->removeLike($session_userinfo['id']); } } break; } $result = method_exists($object, 'drawObjectSocialLine') ? $object->drawObjectSocialLine() : drawObjectSocialLine($object, $unique_identifier); echo utf8_encode($result); exit; } }
function drawDraftRow($draft_count, $drafts_id, $rowclass, $status, $sub_status = '', $designs_id = '') { $descoldata = getDesCol($status); $descol = $descoldata['cols']; $descol_count = $descoldata['count']; $draft = new design_draft($drafts_id); $products = $draft->retrieveProducts(); $detail_link = '<a href="?open=designs-draft-detail&id=' . $draft->id . '&hidemenu=true" class="view_webpage">'; $row .= '<tr id="dra-' . $draft->id . '" class="dra ' . $rowclass . ' desdra-' . $draft->designs_id . '">'; $new_elements = $draft->retrieveElements(); $wax_stats = array(); $wax_stats[] = 'New Wax'; $wax_stats[] = 'Revision'; $qwax = "SELECT mu.id, mu.username"; $qwax .= " FROM minierp_users mu"; $qwax .= " LEFT JOIN minierp_groups_members mgm ON mgm.minierp_users_id = mu.id"; $qwax .= " WHERE mgm.minierp_groups_id = '46'"; $rwax = tep_db_query($qwax); $waxers = array(); while ($r = tep_db_fetch_array($rwax)) { $waxers[$r['id']] = $r['username']; } unset($waxers['137']); foreach ($descol as $class => $key) { $value = ' '; switch ($key) { // case 'Lead Time': // $value = 'DRAFT '.($x+1); // break; case 'ID': $value = $draft->id; if ($draft->colors_request != '') { $value .= '<br/><img src="images/colors_circle_16x16.png" title="This Draft have Colors Requested" />'; } break; case 'Image': $weblink = webImageSource($draft->image_1, IMAGE_SIZE_BIG_1, IMAGE_SIZE_BIG_1); $value = '<a href="' . $weblink . '" class="view_image">' . webImage($draft->image_1, IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1, $draft->name, 'img-border') . '</a>'; break; case 'Name': $value = '<strong>Draft ' . ($draft_count + 1) . '</strong><br />' . ($draft->name == '' ? '<span class="notice">No Name Specified</span>' : '<span>' . $draft->name . '</span>'); break; case 'Products': if (count($products) > 0) { $value = ''; if ($status <= 5 || $status == 13) { foreach ($products as $p) { $value .= productLinkWithID($p['products_id'], $p['products_name'], '&designs_id=' . $designs_id); } } else { foreach ($products as $p) { $pname = htmlspecialchars($p['products_name']); $link = '<a href="?open=product-detail&products_id=' . $p['products_id'] . '" target="_blank" title="' . $pname . '">'; if ($status <= 5) { $link_text = $p['products_id']; } else { $tooltip = $pname; $img_class = ''; if ($status == 8) { $link = '<a href="?open=designs-finalize&id=' . $p['products_id'] . '&hidemenu=true" class="view_webpage">'; if ($p['finalized_time'] != '' && $p['finalized_by'] != '') { $fint = time() - $p['finalized_time']; $duration = $fint > 0 ? displayDuration($fint, 1) . ' ago' : 'just now'; $tooltip = 'Finalized by ' . $p['finalized_by'] . ' (' . trim($duration) . ')'; $img_class = 'img-status-ok'; } else { $img_class = 'img-status-bad'; } } elseif ($status == 7) { $link = '<a href="?open=designs-details&id=' . $p['products_id'] . '&hidemenu=true" class="view_webpage">'; if ($p['detailed_time'] != '' && $p['detailed_by'] != '') { $fint = time() - $p['detailed_time']; $duration = $fint > 0 ? displayDuration($fint, 1) . ' ago' : 'just now'; $tooltip = 'Details Completed by ' . $p['detailed_by'] . ' (' . trim($duration) . ')'; $img_class = 'img-status-ok'; } else { $img_class = 'img-status-bad'; } } elseif ($status == 6) { $link = '<a href="?open=designs-graphics&id=' . $p['products_id'] . '&hidemenu=true" class="view_webpage">'; } $link_text = webimage($p['products_image'], IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1, $tooltip, $img_class, 'style="margin-bottom:1px;"'); } $del = '<div id="delpid-' . $p['products_id'] . '" class="ui-state-default ui-corner-all del-prod" style="width:16px;float:right;" title="Delete Product"><span class="ui-icon ui-icon-close" style="cursor: pointer;"></span></div>'; $value .= '<div>' . $del . $link . $link_text . '</a></div>'; } } } break; case 'Elements': $value = ''; if (count($new_elements) > 0) { foreach ($new_elements as $ne) { $el_style = ''; $el_image = ''; $el_class = ''; if ($ne['elements_image'] != '') { $el_style = 'margin-bottom:1px;'; if ($sub_status == 7) { $el_class = $ne['is_finalized'] == '1' ? 'img-status-ok' : 'img-status-bad'; } $el_image = webImage($ne['elements_image'], IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1, '', $el_class); } use_class('element'); $e = new element($ne['elements_id']); if ($sub_status == 2) { //SHOW WAX COMPLEXITY ON TAB WAX $wax_complexity = $e->wax_complexity != '' ? " ({$e->wax_complexity})" : ''; $wax_complexity_name = $e->wax_complexity != '' ? ' (' . getComplexity($e->wax_complexity) . ' wax complexity)' : ''; } $value .= elementLinkWithID($ne['elements_id'], $ne['elements_id'] . " : " . $ne['elements_description'] . $wax_complexity_name, $drafts_id, $el_style, $el_image, "{$wax_complexity}"); unset($e); //SET NEW ELEMENTS FINALIZED if ((is_null($ne['finalized_date']) || $ne['finalized_date'] == '') && $ne['is_finalized'] == '1') { $sda = array(); $sda['finalized_date'] = date("Y-m-d H:i:s"); $sda['finalized_by'] = $session_userinfo['username']; tep_db_perform('designs_elements', $sda, 'update', "designs_id='" . $design->id . "' AND elements_id=" . $ne['elements_id']); } } } break; case 'Action': $value = ''; $value .= '<input type="hidden" name="drafts_id" value="' . $draft->id . '" />'; $value .= '<input type="hidden" name="status" value="' . $status . '" />'; $value .= '<input type="hidden" name="sub_status" value="' . $sub_status . '" />'; $actions = array(); if ($status == 5) { if ($sub_status == 3) { $ap_class = count($products) > 0 ? ' class="red"' : ' class="green"'; $actions[] = '<input type="button" name="AP"' . $ap_class . ' value="⊕ ADD PRODUCT" title="Add Products to this Draft" />'; } } // if($status==6 && $draft->products_image_by=='') { // $actions[] = '<input type="button" name="GD" class="green" value="® SET AS MINE" title="Set Draft as yours (GD Team only)" />'; // } if ($status == 14 && $draft->products_image_by == '') { if ($sub_status == 1) { $actions[] = '<input type="button" name="GD" class="green" value="® SET AS MINE" title="Set Draft as yours (GD Team only)" />'; } } if ($status == 10 && ($sub_status == '' || $sub_status == 0 || $sub_status == 1)) { $cel_class = count($new_elements) > 0 ? ' class="red"' : ' class="green"'; $actions[] = '<input type="button" name="CE"' . $cel_class . ' value="⊕ CREATE ELEMENT" title="Create New Element for this Draft" />'; } if ($status == 10 && $sub_status == 2) { if ($draft->wax_history_info == '') { $pic_wax = '<div class="pic_wax" style="margin-bottom:5px;float:left;"><strong style="margin-right:5px;">Wax PIC</strong><select id="pic_wax"><option value="0">Show All</option>' . loadComboListFromArray($waxers, null, null, false) . '</select></div>'; $pic_wax .= '<div class="wax_status" style="margin-bottom:5px;float:left;"><strong style="margin-right:5px;">Wax Status</strong><select id="wax_status"><option value="0">Show All</option>' . loadComboListFromArray($wax_stats, null, null, false) . '</select></div>'; $pic_wax .= '<input class="wax_submit" type="button" name="SW" value="Save WAX" title="Save WAX"/>'; $pic_wax .= '<input class="wax_done green" type="button" style="display:none;" name="WD" value="✓ WAX DONE" title="Set Wax as done" />'; } else { if (substr($draft->wax_history_info, -1) == '|') { $pic_wax = '<div class="pic_wax" style="margin-bottom:5px;float:left;"><strong style="margin-right:5px;">Wax PIC</strong><select id="pic_wax"><option value="0">Show All</option>' . loadComboListFromArray($waxers, null, null, false) . '</select></div>'; $pic_wax .= '<div class="wax_status" style="margin-bottom:5px;float:left;"><strong style="margin-right:5px;">Wax Status</strong><select id="wax_status"><option value="0">Show All</option>' . loadComboListFromArray($wax_stats, null, null, false) . '</select></div>'; $pic_wax .= '<input class="wax_submit" type="button" name="SW" value="Save WAX" title="Save WAX"/>'; $pic_wax .= '<input class="wax_done green" type="button" style="display:none;" name="WD" value="✓ WAX DONE" title="Set Wax as done" />'; } else { $pic_wax = '<input class="wax_done green" type="button" name="WD" value="✓ WAX DONE" title="Set Wax as done" />'; $pic_wax .= '<div class="pic_wax" style="margin-bottom:5px;float:left;display:none;"><strong style="margin-right:5px;">Wax PIC</strong><select id="pic_wax"><option value="0">Show All</option>' . loadComboListFromArray($waxers, null, null, false) . '</select></div>'; $pic_wax .= '<div class="wax_status" style="margin-bottom:5px;float:left;display:none;"><strong style="margin-right:5px;">Wax Status</strong><select id="wax_status"><option value="0">Show All</option>' . loadComboListFromArray($wax_stats, null, null, false) . '</select></div>'; $pic_wax .= '<input class="wax_submit" type="button" style="display:none;" name="SW" value="Save WAX" title="Save WAX"/>'; } } $actions[] = $pic_wax; } if ($status == 12 || $status == 7 || $status == 8) { $acttemp = ''; foreach ($products as $p) { $acttemp .= '<div style="height:81px;"><div style="padding-top:40px"><input id="sof-' . $p['products_id'] . '" type="checkbox" name="sample_order"' . ($p['create_sample'] == '1' ? ' checked="checked"' : '') . ' style="width:auto;" title="Check this to auto generate sample order automatically when the product is finalized" /> <label for="sof-' . $p['products_id'] . '">Create <abbr title="Sample Order">SO</abbr></label></div></div>'; } $actions[] = $acttemp; } $clear = '<input type="button" name="DC" value="× CLEAR" title="Clear Approval Status" />'; $kill = '<input type="button" name="DR" class="red" value="× Kill" title="Kill Draft" />'; if ($draft->approve_status == '0') { if ($status == '4') { $actions[] = '<input type="button" name="DA" class="green" value="♥ Approve" title="Approve Draft for New Elements" />'; } if ($status == '4' || $status == '5' || $status == '10') { $actions[] = $kill; } } elseif ($draft->approve_status == 'A') { if ($status < 5) { $actions[] = '<input type="button" class="green" value="♥ Approved" disabled="disabled" />'; } elseif ($status == '5' || $status == '10') { $actions[] = $kill; } if ($status >= 5) { $clear = ''; } } elseif ($draft->approve_status == 'R' && $status < 5) { $actions[] = '<input type="button" class="red" value="♥ Killed" disabled="disabled" />'; } if ($draft->approve_status != '0') { $actions[] = $clear; } $value .= implode('<br />', $actions); break; } if ($key == 'ID' || $key == 'Name') { $value = $detail_link . $value . '</a>'; } if ($key == 'Name') { $showComment = false; $showGD = false; $showWaxHistory = false; if ($status == 10 && $sub_status == 2 && $draft->wax_history_info != '') { $showWaxHistory = true; } if ($draft->comments != '' && $draft->comments_lub != '' && $draft->comments_lut != '') { $showComment = true; } if ($showWaxHistory) { $wax_pic = explode('||', $draft->wax_history_info); $history_array = array(); $p = array(); $history_wax = false; $p['pic w100'] = 'PIC'; $p['start w100'] = 'Start Date'; $p['end w100'] = 'End Date'; $p['wax_status w100'] = 'Status'; $p['lead w100'] = 'Lead Time'; $table_pic[] = $p; foreach ($wax_pic as $text) { list($pics, $wax_status, $start_date, $end_date) = explode('|', $text); if ($end_date == '') { $wax_start = time() - strtotime($start_date); $current_duration = $wax_start > 0 ? displayDuration($wax_start, 1) . ' ago' : 'just now'; $value .= '<br /><br /<span style="font-weight:bold;">PIC Wax: ' . $pics . ' (' . $current_duration . ') - ' . $wax_status . '</span>'; } if ($end_date != '') { $wax_end = strtotime($end_date) - strtotime($start_date); $p['pic w100'] = $pics; $p['start w100'] = date('d-M-y', strtotime($start_date)); $p['end w100'] = date('d-M-y', strtotime($end_date)); $p['wax_status w100'] = $wax_status; $p['lead w100'] = displayDuration($wax_end, 1); $table_pic[] = $p; $history_wax = true; } } if ($history_wax) { $title_pic_wax = tep_draw_table('main_center', $table_pic); $value .= '<br /><div style="float:left;">Wax History</div><span class="ui-icon ui-icon-info"></span><span style="display:none;">' . $title_pic_wax . '</span>'; } } if ($status >= 6 && $draft->products_image_by != '' && $draft->products_image_start != '') { $showGD = true; if ($showComment) { if ($draft->comments_lut < $draft->products_image_start) { $showComment = false; } } } if ($showGD) { $gdstart = time() - $draft->products_image_start; $duration = $gdstart > 0 ? displayDuration($gdstart, 1) . ' ago' : 'just now'; $value .= '<br /><br /><span class="red">GD: <strong>' . $draft->products_image_by . '</strong>'; $value .= ' (' . trim($duration) . ')</span>'; } if ($showComment) { $lastcomment = time() - strtotime($draft->comments_lut); $duration = $lastcomment > 0 ? displayDuration($lastcomment, 1) . ' ago' : 'just now'; //if($lastcomment<1*24*60*60) { $value .= '<br /><br /><span class="red">Last Comment by <strong>' . $draft->comments_lub . '</strong>'; $value .= '<br />posted ' . $duration . '</span>'; } $value = '<div>' . $value . '</div>' . drawObjectSocialLine($draft, 'dra'); } $row .= '<td class="' . $class . '">' . $value . '</td>'; } $row .= '</tr>'; return $row; }
function drawObjectSocialLine($showDelete = null) { if (is_null($showDelete)) { $showDelete = $this->allowDelete(); } $duration_final = $this->drawDuration(); $add_after = array(); $add_after[] = $duration_final; if ($showDelete) { $add_after[] = '<div class="del-text">Delete</div>'; } return drawObjectSocialLine($this, 'wp', '', $add_after); }
$value .= '<input type="hidden" name="pic" value="' . $object->pic . '" />'; break; default: $value = ' '; } //Set column id and name as a link if ($key == 'ID' || $key == 'Name') { $value = $detail_link . $value . '</a>'; } //Add more details to column name if ($key == 'Name' || $key == 'Details') { $value = '<div style="padding:5px 0;"><div>' . $value . '</div>'; if ($object->deadline != '') { $value .= '<table border="0" cellpadding="0" cellspacing="0"><tr><td><img src="images/icon-hazard.png" /></td><td class="red bold">Deadline is ' . date('d.m.Y', strtotime($object->deadline)) . '</td></tr></table>'; } $value .= drawObjectSocialLine($object) . '</div>'; $value = '<div style="float:left;padding:5px 0 0 10px;">' . webImage($object->owner_image, '50', '50', 'Created by ' . $object->owner_name) . '</div><div style="margin-left:70px;">' . $value . '</div>'; } $row .= '<td class="' . $class . '">' . $value . '</td>'; } $row .= '</tr>'; $result = array(); $result['id'] = $id; $result['row'] = $row; $result['status'] = $status; ajaxReturn($result); exit; } elseif ($_POST['me_action'] == 'DELETEDATA') { $id = tep_db_prepare_input($_POST['datas_id']); $improvement = new improvement($id); $improvement->delete();