function display_field_data($field, $valueonly = false, $fixedwidth = 452) { global $ref, $fieldcount, $tabcount, $show_expiry_warning, $access, $tabname, $search, $extra, $lang, $used_tab_names, $related_type_show_with_data, $show_default_related_resources; $value = $field["value"]; $modified_field = hook("beforeviewdisplayfielddata_processing", "", array($field)); if ($modified_field) { $field = $modified_field; } # Handle expiry fields if (!$valueonly && $field["type"] == 6 && $value != "" && $value <= date("Y-m-d H:i") && $show_expiry_warning) { $extra .= "<div class=\"RecordStory\"> <h1>" . $lang["warningexpired"] . "</h1><p>" . $lang["warningexpiredtext"] . "</p><p id=\"WarningOK\"><a href=\"#\" onClick=\"document.getElementById('RecordDownload').style.display='block';document.getElementById('WarningOK').style.display='none';\">" . $lang["warningexpiredok"] . "</a></p></div><style>#RecordDownload {display:none;}</style>"; } if ($value != "" && $value != "," && $field["display_field"] == 1 && ($access == 0 || $access == 1 && !$field["hide_when_restricted"])) { if (!$valueonly) { $title = htmlspecialchars(str_replace("Keywords - ", "", $field["title"])); } else { $title = ""; } //if ($field["type"]==4 || $field["type"]==6) {$value=NiceDate($value,false,true);} # Value formatting if ($field["type"] == 2 || $field["type"] == 7 || $field["type"] == 9) { $i18n_split_keywords = true; } else { $i18n_split_keywords = false; } $value = i18n_get_translated($value, $i18n_split_keywords); if ($field["type"] == 2 || $field["type"] == 3 || $field["type"] == 7 || $field["type"] == 9) { $value = TidyList($value); } $value_unformatted = $value; # store unformatted value for replacement also if ($field["type"] != 8 || $field["type"] == 8 && $value == strip_tags($value)) { $value = nl2br(htmlspecialchars($value)); } $modified_value = hook('display_field_modified_value', '', array($field)); if ($modified_value) { $value = $modified_value['value']; } # draw new tab panel? if (!$valueonly && $tabname != $field["tab_name"] && $fieldcount > 0) { $resource_type_tab_names = sql_array('SELECT tab_name as value FROM resource_type', ''); $resource_type_tab_names = array_filter($resource_type_tab_names); # Display related resources on this tab, if set: if (isset($related_type_show_with_data)) { # NOTE: the resource type tab name and the current tab you are on need to be the same: if (in_array($tabname, $resource_type_tab_names)) { if (($key = array_search($tabname, $resource_type_tab_names)) !== false) { # Fields with display template should be rendered before the related resources list: echo $extra; $extra = ''; include '../include/related_resources.php'; unset($resource_type_tab_names[$key]); $show_default_related_resources = FALSE; } } } $tabcount++; # Also display the custom formatted data $extra at the bottom of this tab panel. ?> <div class="clearerleft"> </div><?php echo $extra; ?> </div></div><div class="TabbedPanel StyledTabbedPanel" style="display:none;" id="tab<?php echo $tabcount; ?> "><div><?php $extra = ""; } $tabname = $field["tab_name"]; $used_tab_names[] = $tabname; $used_tab_names = array_unique($used_tab_names); $fieldcount++; if (!$valueonly && trim($field["display_template"]) != "") { # Process the value using a plugin $plugin = "../plugins/value_filter_" . $field["name"] . ".php"; if ($field['value_filter'] != "") { eval($field['value_filter']); } else { if (file_exists($plugin)) { include $plugin; } else { if ($field["type"] == 4 || $field["type"] == 6) { $value = NiceDate($value, false, true); } } } # Highlight keywords $value = highlightkeywords($value, $search, $field["partial_index"], $field["name"], $field["keywords_index"]); # Use a display template to render this field $template = $field["display_template"]; $template = str_replace("[title]", $title, $template); $template = str_replace("[value]", $value, $template); $template = str_replace("[value_unformatted]", $value_unformatted, $template); $template = str_replace("[ref]", $ref, $template); $extra .= $template; } else { #There is a value in this field, but we also need to check again for a current-language value after the i18n_get_translated() function was called, to avoid drawing empty fields if ($value != "") { # Draw this field normally. # value filter plugin should be used regardless of whether a display template is used. $plugin = "../plugins/value_filter_" . $field["name"] . ".php"; if ($field['value_filter'] != "") { eval($field['value_filter']); } else { if (file_exists($plugin)) { include $plugin; } else { if ($field["type"] == 4 || $field["type"] == 6) { $value = NiceDate($value, false, true); } } } # Highlight keywords $value = highlightkeywords($value, $search, $field["partial_index"], $field["name"], $field["keywords_index"]); ?> <div <?php if (!$valueonly) { echo "class=\"itemNarrow\""; } elseif (isset($fixedwidth)) { echo "style=\"width:" . $fixedwidth . "px\""; } ?> > <h3><?php echo $title; ?> </h3><p><?php echo $value; ?> </p></div><?php } } } }
} else { $value = i18n_get_translated(get_data_by_field($result[$n]['ref'], $rssfield)); } if ($value != "" && $value != ",") { // allow for value filters for ($x = 0; $x < count($df); $x++) { if ($df[$x]['ref'] == $rssfield) { $plugin = "../../value_filter_" . $df[$x]['name'] . ".php"; if ($df[$x]['value_filter'] != "") { eval($df[$x]['value_filter']); } else { if (file_exists($plugin)) { include $plugin; } else { if ($df[$x]["type"] == 4 || $df[$x]["type"] == 6 || $df[$x]["type"] == 10) { $value = NiceDate($value, true, false); } } } if ($rss_show_field_titles) { $add_desc .= $df[$x]['title'] . ": "; } } } $add_desc .= xml_entities(strip_tags($value)) . "<![CDATA[<br/>]]>"; } } } $description = "<![CDATA[<img src='{$imgurl}' align='left' height='75' border='0' />]]>" . $add_desc; $val["pubDate"] = $pubdate; //$val["Category"] = $category;
function display_field_data($field, $valueonly = false, $fixedwidth = 452) { global $ref, $fieldcount, $tabcount, $show_expiry_warning, $access, $tabname, $search, $extra, $lang; $value = $field["value"]; # Handle expiry fields if (!$valueonly && $field["type"] == 6 && $value != "" && $value <= date("Y-m-d H:i") && $show_expiry_warning) { $extra .= "<div class=\"RecordStory\"> <h1>" . $lang["warningexpired"] . "</h1><p>" . $lang["warningexpiredtext"] . "</p><p id=\"WarningOK\"><a href=\"#\" onClick=\"document.getElementById('RecordDownload').style.display='block';document.getElementById('WarningOK').style.display='none';\">" . $lang["warningexpiredok"] . "</a></p></div><style>#RecordDownload {display:none;}</style>"; } if ($value != "" && $value != "," && $field["display_field"] == 1 && ($access == 0 || $access == 1 && !$field["hide_when_restricted"])) { if (!$valueonly) { $title = htmlspecialchars(str_replace("Keywords - ", "", $field["title"])); } else { $title = ""; } //if ($field["type"]==4 || $field["type"]==6) {$value=NiceDate($value,false,true);} # Value formatting if ($field["type"] == 2 || $field["type"] == 7 || $field["type"] == 9) { $i18n_split_keywords = true; } else { $i18n_split_keywords = false; } $value = i18n_get_translated($value, $i18n_split_keywords); if ($field["type"] == 2 || $field["type"] == 3 || $field["type"] == 7 || $field["type"] == 9) { $value = TidyList($value); } $value_unformatted = $value; # store unformatted value for replacement also if ($field["type"] != 8) { $value = nl2br(htmlspecialchars($value)); } # draw new tab panel? if (!$valueonly && $tabname != $field["tab_name"] && $fieldcount > 0) { $tabcount++; # Also display the custom formatted data $extra at the bottom of this tab panel. ?> <div class="clearerleft"> </div><?php echo $extra; ?> </div></div><div class="TabbedPanel StyledTabbedPanel" style="display:none;" id="tab<?php echo $tabcount; ?> "><div><?php $extra = ""; } $tabname = $field["tab_name"]; $fieldcount++; if (!$valueonly && trim($field["display_template"]) != "") { # Process the value using a plugin $plugin = "../plugins/value_filter_" . $field["name"] . ".php"; if ($field['value_filter'] != "") { eval($field['value_filter']); } else { if (file_exists($plugin)) { include $plugin; } else { if ($field["type"] == 4 || $field["type"] == 6) { $value = NiceDate($value, false, true); } } } # Highlight keywords $value = highlightkeywords($value, $search, $field["partial_index"], $field["name"], $field["keywords_index"]); # Use a display template to render this field $template = $field["display_template"]; $template = str_replace("[title]", $title, $template); $template = str_replace("[value]", $value, $template); $template = str_replace("[value_unformatted]", $value_unformatted, $template); $template = str_replace("[ref]", $ref, $template); $extra .= $template; } else { #There is a value in this field, but we also need to check again for a current-language value after the i18n_get_translated() function was called, to avoid drawing empty fields if ($value != "") { # Draw this field normally. # value filter plugin should be used regardless of whether a display template is used. $plugin = "../plugins/value_filter_" . $field["name"] . ".php"; if ($field['value_filter'] != "") { eval($field['value_filter']); } else { if (file_exists($plugin)) { include $plugin; } else { if ($field["type"] == 4 || $field["type"] == 6) { $value = NiceDate($value, false, true); } } } # Highlight keywords $value = highlightkeywords($value, $search, $field["partial_index"], $field["name"], $field["keywords_index"]); ?> <div <?php if (!$valueonly) { echo "class=\"itemNarrow\""; } elseif (isset($fixedwidth)) { echo "style=\"width:" . $fixedwidth . "px\""; } ?> > <h3><?php echo $title; ?> </h3><p><?php echo $value; ?> </p></div><?php } } } }
function display_field($n, $field) { global $ref, $original_fields, $multilingual_text_fields, $is_template, $language, $lang, $errors, $proposed_changes, $editaccess; $edit_autosave = false; $name = "field_" . $field["ref"]; $value = $field["value"]; $value = trim($value); # is there a proposed value set for this field? foreach ($proposed_changes as $proposed_change) { if ($proposed_change["resource_type_field"] == $field["ref"]) { $proposed_value = $proposed_change["value"]; } } // Don't show this if user is an admin viewing proposed changes, needs to be on form so that form is still submitted with all data if ($editaccess && !isset($proposed_value)) { ?> <div style="display:none" > <?php } if ($multilingual_text_fields) { # Multilingual text fields - find all translations and display the translation for the current language. $translations = i18n_get_translations($value); if (array_key_exists($language, $translations)) { $value = $translations[$language]; } else { $value = ""; } } ?> <div class="Question ProposeChangesQuestion" id="question_<?php echo $n; ?> "> <div class="ProposeChangesLabel" ><?php echo htmlspecialchars($field["title"]); ?> </div> <?php # Define some Javascript for help actions (applies to all fields) $help_js = "onBlur=\"HideHelp(" . $field["ref"] . ");return false;\" onFocus=\"ShowHelp(" . $field["ref"] . ");return false;\""; #hook to modify field type in special case. Returning zero (to get a standard text box) doesn't work, so return 1 for type 0, 2 for type 1, etc. $modified_field_type = ""; $modified_field_type = hook("modifyfieldtype"); if ($modified_field_type) { $field["type"] = $modified_field_type - 1; } hook("addfieldextras"); // ------------------------------ // Show existing value so can edit $value = $field["value"]; $realvalue = $value; // Store this in case it gets changed by view processing if ($value != "") { # Draw this field normally. # value filter plugin should be used regardless of whether a display template is used. if ($field['value_filter'] != "") { eval($field['value_filter']); } else { if ($field["type"] == 4 || $field["type"] == 6) { $value = NiceDate($value, false, true); } } ?> <div class="propose_changes_current stdwidth"><?php echo $value; ?> </div><?php } else { ?> <div class="propose_changes_current stdwidth"><?php echo $lang["propose_changes_novalue"]; ?> </div> <?php } ?> <?php if (!$editaccess && !isset($proposed_value)) { ?> <div class="propose_change_button" id="propose_change_button_<?php echo $field["ref"]; ?> "> <input type="submit" value="<?php echo $lang["propose_changes_buttontext"]; ?> " onClick="ShowProposeChanges(<?php echo $field["ref"]; ?> );return false;" /> </div> <?php } ?> <div class="proposed_change" <?php if (!isset($proposed_value)) { echo "style=\"display:none;\""; } ?> id="proposed_change_<?php echo $field["ref"]; ?> "> <input type="hidden" id="propose_change_<?php echo $field["ref"]; ?> " name="propose_change_<?php echo $field["ref"]; ?> " value="true" <?php if (!isset($proposed_value)) { echo "disabled=\"disabled\""; } ?> /> <?php # ---------------------------- Show field ----------------------------------- # Checkif we have a proposed value for this field if (isset($proposed_value)) { $value = $proposed_value; } else { $value = $realvalue; } $type = $field["type"]; if ($type == "") { $type = 0; } # Default to text type. if (!hook("replacefield", "", array($field["type"], $field["ref"], $n))) { global $auto_order_checkbox; include dirname(__FILE__) . "/../../../pages/edit_fields/" . $type . ".php"; } # ---------------------------------------------------------------------------- ?> </div><!-- close proposed_change_<?php echo $field["ref"]; ?> --> <?php if ($editaccess) { ?> <div class="ProposeChangesAccept ProposeChangesAcceptDeleteColumn"> <table> <tr> <td><input class="ProposeChangesAcceptCheckbox" type="checkbox" id="accept_change_<?php echo $field["ref"]; ?> " name="accept_change_<?php echo $field["ref"]; ?> " onchange="UpdateProposals(this,<?php echo $field["ref"]; ?> );" checked ></input><?php echo $lang["propose_changes_accept_change"]; ?> </td> <td> <input class="ProposeChangesDeleteCheckbox" type="checkbox" id="delete_change_<?php echo $field["ref"]; ?> " name="delete_change_<?php echo $field["ref"]; ?> " onchange="DeleteProposal(this,<?php echo $field["ref"]; ?> );" ></input><?php echo $lang["action-delete"]; ?> </td> </tr> </table> </div> <?php } if (trim($field["help_text"] != "")) { # Show inline help for this field. # For certain field types that have no obvious focus, the help always appears. ?> <div class="FormHelp" style="padding:0;<?php if (!in_array($field["type"], array(2, 4, 6, 7, 10))) { ?> display:none;<?php } else { ?> clear:left;<?php } ?> " id="help_<?php echo $field["ref"]; ?> "><div class="FormHelpInner"><?php echo nl2br(trim(htmlspecialchars(i18n_get_translated($field["help_text"], false)))); ?> </div></div> <?php } # If enabled, include code to produce extra fields to allow multilingual free text to be entered. if ($multilingual_text_fields && ($field["type"] == 0 || $field["type"] == 1 || $field["type"] == 5)) { display_multilingual_text_field($n, $field, $translations); } ?> <div class="clearerleft"> </div> </div><!-- end of question_<?php echo $n; ?> div --> <?php // Don't show this if user is an admin viewing proposed changes if ($editaccess && !isset($proposed_value)) { ?> </div><!-- End of hidden field --> <?php } }
function display_field_data($field,$valueonly=false,$fixedwidth=452) { global $ref, $show_expiry_warning, $access, $search, $extra, $lang; $value=$field["value"]; $modified_field=hook("beforeviewdisplayfielddata_processing","",array($field)); if($modified_field){ $field=$modified_field; } # Handle expiry fields if (!$valueonly && $field["type"]==6 && $value!="" && $value<=date("Y-m-d H:i") && $show_expiry_warning) { $extra.="<div class=\"RecordStory\"> <h1>" . $lang["warningexpired"] . "</h1><p>" . $lang["warningexpiredtext"] . "</p><p id=\"WarningOK\"><a href=\"#\" onClick=\"document.getElementById('RecordDownload').style.display='block';document.getElementById('WarningOK').style.display='none';\">" . $lang["warningexpiredok"] . "</a></p></div><style>#RecordDownload {display:none;}</style>"; } if (($value!="") && ($value!=",") && ($field["display_field"]==1) && ($access==0 || ($access==1 && !$field["hide_when_restricted"]))) { if (!$valueonly) {$title=htmlspecialchars(str_replace("Keywords - ","",$field["title"]));} else {$title="";} //if ($field["type"]==4 || $field["type"]==6) {$value=NiceDate($value,false,true);} # Value formatting if (($field["type"]==2) || ($field["type"]==7) || ($field["type"]==9)) {$i18n_split_keywords =true;} else {$i18n_split_keywords =false;} $value=i18n_get_translated($value,$i18n_split_keywords ); if (($field["type"]==2) || ($field["type"]==3) || ($field["type"]==7) || ($field["type"]==9)) {$value=TidyList($value);} // Don't display the comma for radio buttons: if($field['type'] == 12) { $value = str_replace(',', '', $value); } $value_unformatted=$value; # store unformatted value for replacement also if ($field["type"]!=8 || ($field["type"]==8 && $value == strip_tags($value))) # Do not convert HTML formatted fields (that are already HTML) to HTML. Added check for extracted fields set to ckeditor that have not yet been edited. { $value=nl2br(htmlspecialchars($value)); } $modified_value = hook('display_field_modified_value', '', array($field)); if($modified_value) { $value = $modified_value['value']; } if (!$valueonly && trim($field["display_template"])!="") { # Process the value using a plugin $plugin="../plugins/value_filter_" . $field["name"] . ".php"; if ($field['value_filter']!=""){ eval($field['value_filter']); } else if (file_exists($plugin)) {include $plugin;} else if ($field["type"]==4 && strpos($value,":")!=false){$value=NiceDate($value,true,true);} // Show the time as well as date if entered else if ($field["type"]==4 || $field["type"]==6) {$value=NiceDate($value,false,true);} # Highlight keywords $value=highlightkeywords($value,$search,$field["partial_index"],$field["name"],$field["keywords_index"]); $value_mod_after_highlight=hook('value_mod_after_highlight', '', array($field,$value)); if($value_mod_after_highlight){ $value=$value_mod_after_highlight; } # Use a display template to render this field $template=$field["display_template"]; $template=str_replace("[title]",$title,$template); $template=str_replace("[value]",$value,$template); $template=str_replace("[value_unformatted]",$value_unformatted,$template); $template=str_replace("[ref]",$ref,$template); $extra.=$template; } else { #There is a value in this field, but we also need to check again for a current-language value after the i18n_get_translated() function was called, to avoid drawing empty fields if ($value!=""){ # Draw this field normally. # value filter plugin should be used regardless of whether a display template is used. $plugin="../plugins/value_filter_" . $field["name"] . ".php"; if ($field['value_filter']!=""){ eval($field['value_filter']); } else if (file_exists($plugin)) {include $plugin;} else if ($field["type"]==4 && strpos($value,":")!=false){$value=NiceDate($value,true,true);} // Show the time as well as date if entered else if ($field["type"]==4 || $field["type"]==6) {$value=NiceDate($value,false,true);} # Highlight keywords $value=highlightkeywords($value,$search,$field["partial_index"],$field["name"],$field["keywords_index"]); $value_mod_after_highlight=hook('value_mod_after_highlight', '', array($field,$value)); if($value_mod_after_highlight){ $value=$value_mod_after_highlight; } ?><div <?php if (!$valueonly){echo "class=\"itemNarrow\""; } elseif (isset($fixedwidth)) {echo "style=\"width:" . $fixedwidth . "px\""; } ?>> <h3><?php echo $title?></h3><p><?php echo $value?></p></div><?php } } } }
/** * Load and return a listing of the recent orders placed on this store. * Orders are loaded for a specific status if one is passed in via the GET * or via a cookie. * * @return string The recent list of orders HTML. */ public function LoadRecentOrders() { // Do we have permission to view this widget? if (!$this->auth->HasPermission(AUTH_Manage_Orders)) { return false; } // If we don't have a status coming in via the URL, use the default if (!isset($_GET['status'])) { // Maybe it's set in a cookie? Use that if (isset($_COOKIE['DashboardRecentOrdersStatus'])) { $status = $_COOKIE['DashboardRecentOrdersStatus']; } else { $status = 'recent'; } } else { $status = $_GET['status']; } $orderWhere = '1=1'; $statusIn = array(); // Determine which statuses we'll be showing orders for. Will be used in the query. switch ($status) { case 'pending': $statusIn = array(ORDER_STATUS_PENDING, ORDER_STATUS_PARTIALLY_SHIPPED, ORDER_STATUS_AWAITING_PAYMENT, ORDER_STATUS_AWAITING_SHIPMENT, ORDER_STATUS_AWAITING_FULFILLMENT, ORDER_STATUS_AWAITING_PICKUP); break; case 'completed': $statusIn = array(ORDER_STATUS_SHIPPED, ORDER_STATUS_COMPLETED); break; case 'refunded': $statusIn = array(ORDER_STATUS_REFUNDED, ORDER_STATUS_CANCELLED); break; default: $status = 'recent'; } // If they've just changed statuses, store it in a cookie if (isset($_GET['status'])) { isc_setcookie('DashboardRecentOrdersStatus', $status); } if (!empty($statusIn)) { $orderWhere .= " AND ordstatus IN (" . implode(',', $statusIn) . ")"; } // Only get orders for this vendor if ($this->auth->GetVendorId()) { $orderWhere .= " AND ordvendorid='" . $this->auth->GetVendorId() . "'"; } // Fetch orders $query = "\n\t\t\tSELECT orderid, ordbillfirstname, ordbilllastname, ordstatus, orddate, ordtotalamount\n\t\t\tFROM [|PREFIX|]orders\n\t\t\tWHERE " . $orderWhere . " AND ordstatus != 0\n\t\t\tORDER BY orddate DESC\n\t\t"; $query .= $this->db->AddLimit(0, 10); $result = $this->db->Query($query); $orderList = ''; while ($order = $this->db->Fetch($result)) { $this->template->Assign('OrderId', $order['orderid']); $this->template->Assign('OrderStatusId', $order['ordstatus']); $this->template->Assign('OrderStatus', GetOrderStatusById($order['ordstatus'])); $customerName = $order['ordbillfirstname'] . ' ' . $order['ordbilllastname']; if (!trim($customerName)) { $customerName = GetLang('Guest'); } $this->template->Assign('CustomerName', isc_html_escape($customerName)); $orderSummary = sprintf(GetLang('RecentOrdersDateAndTotal'), NiceDate($order['orddate'], true), FormatPrice($order['ordtotalamount'])); $this->template->Assign('OrderSummary', $orderSummary); $orderList .= $this->template->GetSnippet('DashboardRecentOrdersItem'); } if (!$orderList) { $orderList = $this->template->GetSnippet('DashboardRecentOrdersNone'); } return $orderList; }