@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * Created by Raymond Irving Feb, 2005 |
5 | 5 | */ |
6 | 6 | global $BINDINGS; // Array of supported bindings. must be upper case |
7 | -$BINDINGS = array ( |
|
7 | +$BINDINGS = array( |
|
8 | 8 | 'FILE', |
9 | 9 | 'CHUNK', |
10 | 10 | 'DOCUMENT', |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | 'DIRECTORY' |
15 | 15 | ); |
16 | 16 | |
17 | -function ProcessTVCommand($value, $name = '', $docid = '', $src='docform', $tvsArray = array()) { |
|
17 | +function ProcessTVCommand($value, $name = '', $docid = '', $src = 'docform', $tvsArray = array()){ |
|
18 | 18 | global $modx; |
19 | 19 | $docid = intval($docid) ? intval($docid) : $modx->documentIdentifier; |
20 | 20 | $nvalue = trim($value); |
21 | 21 | if (substr($nvalue, 0, 1) != '@') |
22 | 22 | return $value; |
23 | - elseif(isset($modx->config['enable_bindings']) && $modx->config['enable_bindings']!=1 && $src==='docform') { |
|
23 | + elseif (isset($modx->config['enable_bindings']) && $modx->config['enable_bindings'] != 1 && $src === 'docform') { |
|
24 | 24 | return '@Bindings is disabled.'; |
25 | 25 | } |
26 | 26 | else { |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | break; |
47 | 47 | |
48 | 48 | case "SELECT" : // selects a record from the cms database |
49 | - $rt = array (); |
|
50 | - $replacementVars = array ( |
|
49 | + $rt = array(); |
|
50 | + $replacementVars = array( |
|
51 | 51 | 'DBASE' => $modx->db->config['dbase'], |
52 | 52 | 'PREFIX' => $modx->db->config['table_prefix'] |
53 | 53 | ); |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | break; |
89 | 89 | |
90 | 90 | case 'DIRECTORY' : |
91 | - $files = array (); |
|
92 | - $path = $modx->config['base_path'] . $param; |
|
91 | + $files = array(); |
|
92 | + $path = $modx->config['base_path'].$param; |
|
93 | 93 | if (substr($path, -1, 1) != '/') { |
94 | 94 | $path .= '/'; |
95 | 95 | } |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | -function ProcessFile($file) { |
|
120 | +function ProcessFile($file){ |
|
121 | 121 | // get the file |
122 | 122 | $buffer = @file_get_contents($file); |
123 | - if ($buffer===false) $buffer = " Could not retrieve document '$file'."; |
|
123 | + if ($buffer === false) $buffer = " Could not retrieve document '$file'."; |
|
124 | 124 | return $buffer; |
125 | 125 | } |
126 | 126 | |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | { |
130 | 130 | global $BINDINGS; |
131 | 131 | $binding_array = array(); |
132 | - foreach($BINDINGS as $cmd) |
|
132 | + foreach ($BINDINGS as $cmd) |
|
133 | 133 | { |
134 | - if(strpos($binding_string,'@'.$cmd)===0) |
|
134 | + if (strpos($binding_string, '@'.$cmd) === 0) |
|
135 | 135 | { |
136 | - $code = substr($binding_string,strlen($cmd)+1); |
|
137 | - $binding_array = array($cmd,trim($code)); |
|
136 | + $code = substr($binding_string, strlen($cmd) + 1); |
|
137 | + $binding_array = array($cmd, trim($code)); |
|
138 | 138 | break; |
139 | 139 | } |
140 | 140 | } |
@@ -149,12 +149,12 @@ discard block |
||
149 | 149 | if (strpos($param, '[*') !== false) { |
150 | 150 | $matches = $modx->getTagsFromContent($param, '[*', '*]'); |
151 | 151 | foreach ($matches[0] as $i=>$match) { |
152 | - if(isset($tvsArray[ $matches[1][$i] ])) { |
|
153 | - if(is_array($tvsArray[ $matches[1][$i] ])) { |
|
152 | + if (isset($tvsArray[$matches[1][$i]])) { |
|
153 | + if (is_array($tvsArray[$matches[1][$i]])) { |
|
154 | 154 | $value = $tvsArray[$matches[1][$i]]['value']; |
155 | 155 | $value = $value === '' ? $tvsArray[$matches[1][$i]]['default_text'] : $value; |
156 | 156 | } else { |
157 | - $value = $tvsArray[ $matches[1][$i] ]; |
|
157 | + $value = $tvsArray[$matches[1][$i]]; |
|
158 | 158 | } |
159 | 159 | $param = str_replace($match, $value, $param); |
160 | 160 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | $sysMsgs = ""; |
14 | 14 | $limit = count($SystemAlertMsgQueque); |
15 | - for($i=0;$i<$limit;$i++) { |
|
15 | + for ($i = 0; $i < $limit; $i++) { |
|
16 | 16 | $sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>"; |
17 | 17 | } |
18 | 18 | // reset message queque |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $_SESSION['SystemAlertMsgQueque'] = array(); |
21 | 21 | $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
22 | 22 | |
23 | - if($sysMsgs!="") { |
|
23 | + if ($sysMsgs != "") { |
|
24 | 24 | ?> |
25 | 25 | |
26 | 26 | <?php // fetch the styles |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | var sysAlert = new Element('div').setProperties({ |
33 | 33 | 'class': 'sysAlert' |
34 | 34 | }); |
35 | - sysAlert.innerHTML = '<?php echo $modx->db->escape($sysMsgs);?>'; |
|
35 | + sysAlert.innerHTML = '<?php echo $modx->db->escape($sysMsgs); ?>'; |
|
36 | 36 | var boxHtml = new MooPrompt('<?php echo $_lang['sys_alert']; ?>', sysAlert, { |
37 | 37 | buttons: 1, |
38 | 38 | button1: 'Ok', |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | class Paging |
32 | 32 | { |
33 | 33 | |
34 | - var $int_num_result; // Number of result to show per page (decided by user) |
|
35 | - var $int_nbr_row; // Total number of items (SQL count from db) |
|
36 | - var $int_cur_position;// Current position in recordset |
|
37 | - var $str_ext_argv; // Extra argv of query string |
|
34 | + var $int_num_result; // Number of result to show per page (decided by user) |
|
35 | + var $int_nbr_row; // Total number of items (SQL count from db) |
|
36 | + var $int_cur_position; // Current position in recordset |
|
37 | + var $str_ext_argv; // Extra argv of query string |
|
38 | 38 | |
39 | 39 | // ------------------------------------------------------------------------ Constructor |
40 | 40 | // |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | $array_paging['total'] = $this->int_nbr_row; |
65 | 65 | |
66 | 66 | if ($this->int_cur_position != 0) { |
67 | - $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0" . $this->str_ext_argv . "\">"; |
|
68 | - $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . ($this->int_cur_position - $this->int_num_result) . $this->str_ext_argv . "\">"; |
|
67 | + $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0".$this->str_ext_argv."\">"; |
|
68 | + $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=".($this->int_cur_position - $this->int_num_result).$this->str_ext_argv."\">"; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | if (($this->int_nbr_row - $this->int_cur_position) > $this->int_num_result) { |
72 | 72 | $int_new_position = $this->int_cur_position + $this->int_num_result; |
73 | - $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . $this->int_nbr_row . $this->str_ext_argv . "\">"; |
|
74 | - $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position" . $this->str_ext_argv . "\">"; |
|
73 | + $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=".$this->int_nbr_row.$this->str_ext_argv."\">"; |
|
74 | + $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position".$this->str_ext_argv."\">"; |
|
75 | 75 | } |
76 | 76 | return $array_paging; |
77 | 77 | } // end function |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | for ($i = 0; $i < $this->getNumberOfPage(); $i++) { |
87 | 87 | // if current page, do not make a link |
88 | 88 | if ($i == $this->getCurrentPage()) { |
89 | - $array_all_page[$i] = "<b>" . ($i + 1) . "</b> "; |
|
89 | + $array_all_page[$i] = "<b>".($i + 1)."</b> "; |
|
90 | 90 | } else { |
91 | 91 | $int_new_position = ($i * $this->int_num_result); |
92 | - $array_all_page[$i] = "<a href=\"" . $PHP_SELF . "?int_cur_position=$int_new_position$this->str_ext_argv\">" . ($i + 1) . "</a> "; |
|
92 | + $array_all_page[$i] = "<a href=\"".$PHP_SELF."?int_cur_position=$int_new_position$this->str_ext_argv\">".($i + 1)."</a> "; |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | return $array_all_page; |
@@ -12,13 +12,13 @@ |
||
12 | 12 | $modx->invokeEvent('OnManagerPageInit'); |
13 | 13 | $ok = false; |
14 | 14 | |
15 | -if($modx->elementIsLocked($_GET['type'], $_GET['id'], true)) { |
|
15 | +if ($modx->elementIsLocked($_GET['type'], $_GET['id'], true)) { |
|
16 | 16 | $modx->lockElement($_GET['type'], $_GET['id'], true); |
17 | 17 | $ok = true; |
18 | 18 | } |
19 | 19 | |
20 | 20 | header('Content-type: application/json'); |
21 | -if($ok) { |
|
21 | +if ($ok) { |
|
22 | 22 | echo '{status:"ok"}'; |
23 | 23 | } else { |
24 | 24 | echo '{status:"null"}'; |
@@ -12,24 +12,24 @@ discard block |
||
12 | 12 | |
13 | 13 | */ |
14 | 14 | |
15 | -class logHandler { |
|
15 | +class logHandler{ |
|
16 | 16 | // Single variable for a log entry |
17 | 17 | var $entry = array(); |
18 | 18 | |
19 | - function initAndWriteLog($msg="", $internalKey="", $username="", $action="", $itemid="", $itemname="") { |
|
19 | + function initAndWriteLog($msg = "", $internalKey = "", $username = "", $action = "", $itemid = "", $itemname = ""){ |
|
20 | 20 | global $modx; |
21 | 21 | $this->entry['msg'] = $msg; // writes testmessage to the object |
22 | - $this->entry['action'] = empty($action)? $modx->manager->action : $action; // writes the action to the object |
|
22 | + $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object |
|
23 | 23 | |
24 | 24 | // User Credentials |
25 | 25 | $this->entry['internalKey'] = $internalKey == "" ? $modx->getLoginUserID() : $internalKey; |
26 | 26 | $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username; |
27 | 27 | |
28 | - $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid; // writes the id to the object |
|
29 | - if($this->entry['itemId'] == 0) $this->entry['itemId'] = "-"; // to stop items having id 0 |
|
28 | + $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int) $_REQUEST['id'] : $itemid; // writes the id to the object |
|
29 | + if ($this->entry['itemId'] == 0) $this->entry['itemId'] = "-"; // to stop items having id 0 |
|
30 | 30 | |
31 | - $this->entry['itemName'] = ($itemname == "" && isset($_SESSION['itemname']))? $_SESSION['itemname'] : $itemname; // writes the id to the object |
|
32 | - if($this->entry['itemName'] == "") $this->entry['itemName'] = "-"; // to stop item name being empty |
|
31 | + $this->entry['itemName'] = ($itemname == "" && isset($_SESSION['itemname'])) ? $_SESSION['itemname'] : $itemname; // writes the id to the object |
|
32 | + if ($this->entry['itemName'] == "") $this->entry['itemName'] = "-"; // to stop item name being empty |
|
33 | 33 | |
34 | 34 | $this->writeToLog(); |
35 | 35 | return; |
@@ -38,20 +38,20 @@ discard block |
||
38 | 38 | // function to write to the log |
39 | 39 | // collects all required info, and |
40 | 40 | // writes it to the logging table |
41 | - function writeToLog() { |
|
41 | + function writeToLog(){ |
|
42 | 42 | global $modx; |
43 | 43 | $tbl_manager_log = $modx->getFullTableName('manager_log'); |
44 | 44 | |
45 | - if($this->entry['internalKey'] == "") { |
|
45 | + if ($this->entry['internalKey'] == "") { |
|
46 | 46 | $modx->webAlertAndQuit("Logging error: internalKey not set."); |
47 | 47 | } |
48 | - if(empty($this->entry['action'])) { |
|
48 | + if (empty($this->entry['action'])) { |
|
49 | 49 | $modx->webAlertAndQuit("Logging error: action not set."); |
50 | 50 | } |
51 | - if($this->entry['msg'] == "") { |
|
51 | + if ($this->entry['msg'] == "") { |
|
52 | 52 | include_once "actionlist.inc.php"; |
53 | 53 | $this->entry['msg'] = getAction($this->entry['action'], $this->entry['itemId']); |
54 | - if($this->entry['msg'] == "") { |
|
54 | + if ($this->entry['msg'] == "") { |
|
55 | 55 | $modx->webAlertAndQuit("Logging error: couldn't find message to write to log."); |
56 | 56 | } |
57 | 57 | } |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | $fields['itemid'] = $this->entry['itemId']; |
64 | 64 | $fields['itemname'] = $modx->db->escape($this->entry['itemName']); |
65 | 65 | $fields['message'] = $modx->db->escape($this->entry['msg']); |
66 | - $insert_id = $modx->db->insert($fields,$tbl_manager_log); |
|
67 | - if(!$insert_id) { |
|
66 | + $insert_id = $modx->db->insert($fields, $tbl_manager_log); |
|
67 | + if (!$insert_id) { |
|
68 | 68 | $modx->messageQuit("Logging error: couldn't save log to table! Error code: ".$modx->db->getLastError()); |
69 | 69 | } else { |
70 | 70 | $limit = (isset($modx->config['manager_log_limit'])) ? intval($modx->config['manager_log_limit']) : 3000; |
71 | - $trim = (isset($modx->config['manager_log_trim'])) ? intval($modx->config['manager_log_trim']) : 100; |
|
72 | - if(($insert_id % $trim) === 0) { |
|
73 | - $modx->rotate_log('manager_log',$limit,$trim); |
|
71 | + $trim = (isset($modx->config['manager_log_trim'])) ? intval($modx->config['manager_log_trim']) : 100; |
|
72 | + if (($insert_id % $trim) === 0) { |
|
73 | + $modx->rotate_log('manager_log', $limit, $trim); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | } |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | $countChild++; |
66 | 66 | $id = $value[0]; |
67 | 67 | $ph['id'] = $id; |
68 | - $ph['li_class'] = $this->get_li_class($id) . $value[10]; |
|
68 | + $ph['li_class'] = $this->get_li_class($id).$value[10]; |
|
69 | 69 | $ph['href'] = $value[3]; |
70 | 70 | $ph['alt'] = $value[4]; |
71 | 71 | $ph['target'] = $value[7]; |
72 | 72 | $ph['onclick'] = $value[5]; |
73 | 73 | $ph['a_class'] = $this->get_a_class($id); |
74 | 74 | $ph['LinkAttr'] = $this->getLinkAttr($id); |
75 | - $ph['itemName'] = $value[2] . $this->getItemName($id); |
|
75 | + $ph['itemName'] = $value[2].$this->getItemName($id); |
|
76 | 76 | |
77 | 77 | $ph['DrawSub'] = ''; |
78 | 78 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | function get_li_class($id) |
112 | 112 | { |
113 | 113 | if (isset($this->menu[$id])) { |
114 | - return $this->defaults['parentClass'] . ' '; |
|
114 | + return $this->defaults['parentClass'].' '; |
|
115 | 115 | } else { |
116 | 116 | return ''; |
117 | 117 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | function get_a_class($id) |
121 | 121 | { |
122 | 122 | if (isset($this->menu[$id])) { |
123 | - return ' class="' . $this->defaults['parentLinkClass'] . '"'; |
|
123 | + return ' class="'.$this->defaults['parentLinkClass'].'"'; |
|
124 | 124 | } else { |
125 | 125 | return ''; |
126 | 126 | } |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -Class TemplateParser { |
|
10 | +Class TemplateParser{ |
|
11 | 11 | |
12 | - function __construct() { |
|
12 | + function __construct(){ |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | /** |
@@ -17,46 +17,46 @@ discard block |
||
17 | 17 | * @param array $data |
18 | 18 | * @return string |
19 | 19 | */ |
20 | - public function output($config = array(), $data = array()) { |
|
20 | + public function output($config = array(), $data = array()){ |
|
21 | 21 | global $modx; |
22 | 22 | |
23 | 23 | $output = ''; |
24 | 24 | $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
25 | - $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
|
25 | + $tab = isset($config['tab']) ? ' AND tab IN('.$config['tab'].')' : ''; |
|
26 | 26 | |
27 | - if($action) { |
|
27 | + if ($action) { |
|
28 | 28 | $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
29 | - FROM ' . $modx->getFullTableName('system_templates') . ' AS t1 |
|
30 | - INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category |
|
31 | - WHERE t1.action IN(' . $action . ') ' . $tab . ' |
|
29 | + FROM ' . $modx->getFullTableName('system_templates').' AS t1 |
|
30 | + INNER JOIN ' . $modx->getFullTableName('categories').' AS t2 ON t2.id=t1.category |
|
31 | + WHERE t1.action IN(' . $action.') '.$tab.' |
|
32 | 32 | ORDER BY t1.tab ASC, t1.rank ASC'); |
33 | 33 | |
34 | - if($modx->db->getRecordCount($sql)) { |
|
34 | + if ($modx->db->getRecordCount($sql)) { |
|
35 | 35 | $tabs = array(); |
36 | - while($row = $modx->db->getRow($sql)) { |
|
37 | - if(!$row['value'] && !empty($data[$row['name']])) { |
|
36 | + while ($row = $modx->db->getRow($sql)) { |
|
37 | + if (!$row['value'] && !empty($data[$row['name']])) { |
|
38 | 38 | $row['value'] = $data[$row['name']]; |
39 | 39 | } |
40 | 40 | $tabs[$row['tab']]['category_name'] = $row['category_name']; |
41 | 41 | $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
42 | 42 | } |
43 | 43 | |
44 | - if(!empty($config['toArray'])) { |
|
44 | + if (!empty($config['toArray'])) { |
|
45 | 45 | $output = $tabs; |
46 | 46 | } else { |
47 | - $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
47 | + $output .= '<div class="tab-pane" id="pane_'.$action.'">'; |
|
48 | 48 | $output .= ' |
49 | 49 | <script type="text/javascript"> |
50 | - var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
50 | + var pane_' . $action.' = new WebFXTabPane(document.getElementById("pane_'.$action.'"), '.($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
51 | 51 | </script>'; |
52 | 52 | |
53 | - foreach($tabs as $idTab => $tab) { |
|
54 | - $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
53 | + foreach ($tabs as $idTab => $tab) { |
|
54 | + $output .= '<div class="tab-page" id="tab_'.$action.'_'.$idTab.'">'; |
|
55 | 55 | $output .= ' |
56 | - <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
|
57 | - <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>'; |
|
56 | + <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']).'</h2> |
|
57 | + <script type="text/javascript">pane_' . $action.'.addTabPage(document.getElementById("tab_'.$action.'_'.$idTab.'"));</script>'; |
|
58 | 58 | unset($tab['category_name']); |
59 | - foreach($tab as $item) { |
|
59 | + foreach ($tab as $item) { |
|
60 | 60 | $output .= $item; |
61 | 61 | } |
62 | 62 | $output .= '</div>'; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | return $output; |
70 | 70 | } |
71 | 71 | |
72 | - private function render($data) { |
|
72 | + private function render($data){ |
|
73 | 73 | global $modx, $_lang, $_country_lang; |
74 | 74 | |
75 | 75 | $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $output = ''; |
80 | 80 | $output .= '<div class="form-group row">'; |
81 | 81 | |
82 | - switch($data['type']) { |
|
82 | + switch ($data['type']) { |
|
83 | 83 | |
84 | 84 | case 'text': |
85 | 85 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
@@ -113,18 +113,18 @@ discard block |
||
113 | 113 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
114 | 114 | $output .= '<div class="col-sm-7">'; |
115 | 115 | $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
116 | - if($data['name'] == 'country' && isset($_country_lang)) { |
|
116 | + if ($data['name'] == 'country' && isset($_country_lang)) { |
|
117 | 117 | $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
118 | - $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
119 | - foreach($_country_lang as $key => $value) { |
|
120 | - $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
118 | + $output .= '<option value=""'.(!isset($chosenCountry) ? ' selected' : '').'> </option>'; |
|
119 | + foreach ($_country_lang as $key => $value) { |
|
120 | + $output .= '<option value="'.$key.'"'.(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').'>'.$value.'</option>'; |
|
121 | 121 | } |
122 | 122 | } else { |
123 | - if($data['elements']) { |
|
123 | + if ($data['elements']) { |
|
124 | 124 | $elements = explode('||', $data['elements']); |
125 | - foreach($elements as $key => $value) { |
|
125 | + foreach ($elements as $key => $value) { |
|
126 | 126 | $value = explode('==', $value); |
127 | - $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
127 | + $output .= '<option value="'.$value[1].'">'.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]).'</option>'; |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | } |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
139 | 139 | $output .= '<div class="col-sm-7">'; |
140 | 140 | $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
141 | - if($data['elements']) { |
|
141 | + if ($data['elements']) { |
|
142 | 142 | $elements = explode('||', $data['elements']); |
143 | - foreach($elements as $key => $value) { |
|
143 | + foreach ($elements as $key => $value) { |
|
144 | 144 | $value = explode('==', $value); |
145 | - $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
145 | + $output .= '<br /><input type="checkbox" name="'.$value[0].'" class="form-control" id="'.$value[0].'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | $output .= $data['content']; |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
155 | 155 | $output .= '<div class="col-sm-7">'; |
156 | 156 | $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
157 | - if($data['elements']) { |
|
157 | + if ($data['elements']) { |
|
158 | 158 | $elements = explode('||', $data['elements']); |
159 | - foreach($elements as $key => $value) { |
|
159 | + foreach ($elements as $key => $value) { |
|
160 | 160 | $value = explode('==', $value); |
161 | - $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
161 | + $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_'.$key.'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | $output .= $data['content']; |
@@ -3,59 +3,59 @@ |
||
3 | 3 | global $ContextMenuCnt; |
4 | 4 | $ContextMenuCnt = 0; |
5 | 5 | |
6 | -class ContextMenu { |
|
6 | +class ContextMenu{ |
|
7 | 7 | var $id; |
8 | 8 | |
9 | - function __construct($id = '', $width = 120, $visible = false) { |
|
9 | + function __construct($id = '', $width = 120, $visible = false){ |
|
10 | 10 | global $ContextMenuCnt; |
11 | 11 | $ContextMenuCnt++; |
12 | 12 | $this->html = ""; |
13 | 13 | $this->visible = $visible ? $visible : false; |
14 | 14 | $this->width = is_numeric($width) ? intval($width) : 120; |
15 | - $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
|
15 | + $this->id = $id ? $id : "cntxMnu".$ContextMenuCnt; // set id |
|
16 | 16 | } |
17 | 17 | |
18 | - function addItem($text, $action = "", $img = "", $disabled = 0) { |
|
18 | + function addItem($text, $action = "", $img = "", $disabled = 0){ |
|
19 | 19 | global $base_url, $_style; |
20 | - if($disabled) { |
|
20 | + if ($disabled) { |
|
21 | 21 | return; |
22 | 22 | } |
23 | - if(!$img) { |
|
24 | - $img = $base_url . $_style['tx']; |
|
23 | + if (!$img) { |
|
24 | + $img = $base_url.$_style['tx']; |
|
25 | 25 | } |
26 | - if(substr($action, 0, 3) == "js:") { |
|
26 | + if (substr($action, 0, 3) == "js:") { |
|
27 | 27 | $action = substr($action, 3); |
28 | - } else if(substr($action, 0, 3) == "hl:") { |
|
29 | - $action = "window.location.href='" . substr($action, 3) . "'"; |
|
28 | + } else if (substr($action, 0, 3) == "hl:") { |
|
29 | + $action = "window.location.href='".substr($action, 3)."'"; |
|
30 | 30 | } else { |
31 | - $action = "window.location.href='" . $action . "'"; |
|
31 | + $action = "window.location.href='".$action."'"; |
|
32 | 32 | } |
33 | - $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('" . $this->id . "');\""; |
|
34 | - $this->html .= "<div class='" . ($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem") . "' $action>"; |
|
35 | - if(substr($img, 0, 5) == 'fa fa') { |
|
36 | - $img = '<i class="' . $img . '"></i>'; |
|
37 | - } else if(substr($img, 0, 1) != '<') { |
|
38 | - $img = '<img src="' . $img . '" />'; |
|
33 | + $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('".$this->id."');\""; |
|
34 | + $this->html .= "<div class='".($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem")."' $action>"; |
|
35 | + if (substr($img, 0, 5) == 'fa fa') { |
|
36 | + $img = '<i class="'.$img.'"></i>'; |
|
37 | + } else if (substr($img, 0, 1) != '<') { |
|
38 | + $img = '<img src="'.$img.'" />'; |
|
39 | 39 | } |
40 | - $this->html .= $img . ' ' . $text . '</div>'; |
|
40 | + $this->html .= $img.' '.$text.'</div>'; |
|
41 | 41 | } |
42 | 42 | |
43 | - function addSeparator() { |
|
43 | + function addSeparator(){ |
|
44 | 44 | $this->html .= " |
45 | 45 | <div class='cntxMnuSeparator'></div> |
46 | 46 | "; |
47 | 47 | } |
48 | 48 | |
49 | - function render() { |
|
49 | + function render(){ |
|
50 | 50 | global $ContextMenuScript; |
51 | 51 | |
52 | - $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
|
52 | + $html = $ContextMenuScript."<div id='".$this->id."' class='contextMenu' style='width:".$this->width."px; visibility:".($this->visible ? 'visible' : 'hidden')."'>".$this->html."</div>"; |
|
53 | 53 | $ContextMenuScript = ""; // reset css |
54 | 54 | return $html; |
55 | 55 | } |
56 | 56 | |
57 | - function getClientScriptObject() { |
|
58 | - return "getCntxMenu('" . $this->id . "')"; |
|
57 | + function getClientScriptObject(){ |
|
58 | + return "getCntxMenu('".$this->id."')"; |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 |
@@ -10,14 +10,14 @@ discard block |
||
10 | 10 | |
11 | 11 | $__DataGridCnt = 0; |
12 | 12 | |
13 | -class DataGrid { |
|
13 | +class DataGrid{ |
|
14 | 14 | |
15 | 15 | var $ds; // datasource |
16 | 16 | var $id; |
17 | - var $pageSize; // pager settings |
|
17 | + var $pageSize; // pager settings |
|
18 | 18 | var $pageNumber; |
19 | 19 | var $pager; |
20 | - var $pagerLocation; // top-right, top-left, bottom-left, bottom-right, both-left, both-right |
|
20 | + var $pagerLocation; // top-right, top-left, bottom-left, bottom-right, both-left, both-right |
|
21 | 21 | |
22 | 22 | var $cssStyle; |
23 | 23 | var $cssClass; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | var $colAligns; |
36 | 36 | var $colWraps; |
37 | 37 | var $colColors; |
38 | - var $colTypes; // coltype1, coltype2, etc or coltype1:format1, e.g. date:%Y %m |
|
38 | + var $colTypes; // coltype1, coltype2, etc or coltype1:format1, e.g. date:%Y %m |
|
39 | 39 | // data type: integer,float,currency,date |
40 | 40 | |
41 | 41 | var $header; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | var $cellPadding; |
44 | 44 | var $cellSpacing; |
45 | 45 | |
46 | - var $rowAlign; // vertical alignment: top, middle, bottom |
|
46 | + var $rowAlign; // vertical alignment: top, middle, bottom |
|
47 | 47 | var $rowIdField; |
48 | 48 | |
49 | 49 | var $pagerStyle; |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | var $selPageClass; |
53 | 53 | var $noRecordMsg = "No records found."; |
54 | 54 | |
55 | - function __construct($id, $ds, $pageSize = 20, $pageNumber = -1) { |
|
55 | + function __construct($id, $ds, $pageSize = 20, $pageNumber = -1){ |
|
56 | 56 | global $__DataGridCnt; |
57 | 57 | |
58 | 58 | // set id |
59 | 59 | $__DataGridCnt++; |
60 | - $this->id = $this->id ? $id : "dg" . $__DataGridCnt; |
|
60 | + $this->id = $this->id ? $id : "dg".$__DataGridCnt; |
|
61 | 61 | |
62 | 62 | // set datasource |
63 | 63 | $this->ds = $ds; |
@@ -68,50 +68,50 @@ discard block |
||
68 | 68 | $this->pagerLocation = 'top-right'; |
69 | 69 | } |
70 | 70 | |
71 | - function setDataSource($ds) { |
|
71 | + function setDataSource($ds){ |
|
72 | 72 | $this->ds = $ds; |
73 | 73 | } |
74 | 74 | |
75 | - function render() { |
|
75 | + function render(){ |
|
76 | 76 | global $modx; |
77 | - $columnHeaderStyle = ($this->columnHeaderStyle) ? "style='" . $this->columnHeaderStyle . "'" : ''; |
|
78 | - $columnHeaderClass = ($this->columnHeaderClass) ? "class='" . $this->columnHeaderClass . "'" : ""; |
|
79 | - $cssStyle = ($this->cssStyle) ? "style='" . $this->cssStyle . "'" : ''; |
|
80 | - $cssClass = ($this->cssClass) ? "class='" . $this->cssClass . "'" : ''; |
|
77 | + $columnHeaderStyle = ($this->columnHeaderStyle) ? "style='".$this->columnHeaderStyle."'" : ''; |
|
78 | + $columnHeaderClass = ($this->columnHeaderClass) ? "class='".$this->columnHeaderClass."'" : ""; |
|
79 | + $cssStyle = ($this->cssStyle) ? "style='".$this->cssStyle."'" : ''; |
|
80 | + $cssClass = ($this->cssClass) ? "class='".$this->cssClass."'" : ''; |
|
81 | 81 | |
82 | - $pagerClass = ($this->pagerClass) ? "class='" . $this->pagerClass . "'" : ''; |
|
83 | - $pagerStyle = ($this->pagerStyle) ? "style='" . $this->pagerStyle . "'" : "style='background-color:#ffffff;'"; |
|
82 | + $pagerClass = ($this->pagerClass) ? "class='".$this->pagerClass."'" : ''; |
|
83 | + $pagerStyle = ($this->pagerStyle) ? "style='".$this->pagerStyle."'" : "style='background-color:#ffffff;'"; |
|
84 | 84 | |
85 | - $this->_itemStyle = ($this->itemStyle) ? "style='" . $this->itemStyle . "'" : ''; |
|
86 | - $this->_itemClass = ($this->itemClass) ? "class='" . $this->itemClass . "'" : ''; |
|
87 | - $this->_altItemStyle = ($this->altItemStyle) ? "style='" . $this->altItemStyle . "'" : ''; |
|
88 | - $this->_altItemClass = ($this->altItemClass) ? "class='" . $this->altItemClass . "'" : ''; |
|
85 | + $this->_itemStyle = ($this->itemStyle) ? "style='".$this->itemStyle."'" : ''; |
|
86 | + $this->_itemClass = ($this->itemClass) ? "class='".$this->itemClass."'" : ''; |
|
87 | + $this->_altItemStyle = ($this->altItemStyle) ? "style='".$this->altItemStyle."'" : ''; |
|
88 | + $this->_altItemClass = ($this->altItemClass) ? "class='".$this->altItemClass."'" : ''; |
|
89 | 89 | |
90 | 90 | $this->_alt = 0; |
91 | 91 | $this->_total = 0; |
92 | 92 | |
93 | 93 | $this->_isDataset = $modx->db->isResult($this->ds); // if not dataset then treat as array |
94 | 94 | |
95 | - if(!$cssStyle && !$cssClass) { |
|
95 | + if (!$cssStyle && !$cssClass) { |
|
96 | 96 | $cssStyle = "style='width:100%;border:1px solid silver;font-family:verdana,arial; font-size:11px;'"; |
97 | 97 | } |
98 | - if(!$columnHeaderStyle && !$columnHeaderClass) { |
|
98 | + if (!$columnHeaderStyle && !$columnHeaderClass) { |
|
99 | 99 | $columnHeaderStyle = "style='color:black;background-color:silver'"; |
100 | 100 | } |
101 | - if(!$this->_itemStyle && !$this->_itemClass) { |
|
101 | + if (!$this->_itemStyle && !$this->_itemClass) { |
|
102 | 102 | $this->_itemStyle = "style='color:black;'"; |
103 | 103 | } |
104 | - if(!$this->_altItemStyle && !$this->_altItemClass) { |
|
104 | + if (!$this->_altItemStyle && !$this->_altItemClass) { |
|
105 | 105 | $this->_altItemStyle = "style='color:black;background-color:#eeeeee'"; |
106 | 106 | } |
107 | 107 | |
108 | - if($this->_isDataset && !$this->columns) { |
|
108 | + if ($this->_isDataset && !$this->columns) { |
|
109 | 109 | $cols = $modx->db->numFields($this->ds); |
110 | - for($i = 0; $i < $cols; $i++) $this->columns .= ($i ? "," : "") . $modx->db->fieldName($this->ds, $i); |
|
110 | + for ($i = 0; $i < $cols; $i++) $this->columns .= ($i ? "," : "").$modx->db->fieldName($this->ds, $i); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | // start grid |
114 | - $tblStart = "<table $cssClass $cssStyle cellpadding='" . (isset($this->cellPadding) ? (int) $this->cellPadding : 1) . "' cellspacing='" . (isset($this->cellSpacing) ? (int) $this->cellSpacing : 1) . "'>"; |
|
114 | + $tblStart = "<table $cssClass $cssStyle cellpadding='".(isset($this->cellPadding) ? (int) $this->cellPadding : 1)."' cellspacing='".(isset($this->cellSpacing) ? (int) $this->cellSpacing : 1)."'>"; |
|
115 | 115 | $tblEnd = "</table>"; |
116 | 116 | |
117 | 117 | // build column header |
@@ -122,33 +122,33 @@ discard block |
||
122 | 122 | $this->_colcolors = explode((strstr($this->colColors, "||") !== false ? "||" : ","), $this->colColors); |
123 | 123 | $this->_coltypes = explode((strstr($this->colTypes, "||") !== false ? "||" : ","), $this->colTypes); |
124 | 124 | $this->_colcount = count($this->_colnames); |
125 | - if(!$this->_isDataset) { |
|
125 | + if (!$this->_isDataset) { |
|
126 | 126 | $this->ds = explode((strstr($this->ds, "||") !== false ? "||" : ","), $this->ds); |
127 | 127 | $this->ds = array_chunk($this->ds, $this->_colcount); |
128 | 128 | } |
129 | 129 | $tblColHdr = "<thead><tr>"; |
130 | - for($c = 0; $c < $this->_colcount; $c++) { |
|
130 | + for ($c = 0; $c < $this->_colcount; $c++) { |
|
131 | 131 | $name = $this->_colnames[$c]; |
132 | 132 | $width = $this->_colwidths[$c]; |
133 | - $tblColHdr .= "<td $columnHeaderStyle $columnHeaderClass" . ($width ? " width='$width'" : "") . ">$name</td>"; |
|
133 | + $tblColHdr .= "<td $columnHeaderStyle $columnHeaderClass".($width ? " width='$width'" : "").">$name</td>"; |
|
134 | 134 | } |
135 | 135 | $tblColHdr .= "</tr></thead>\n"; |
136 | 136 | |
137 | 137 | // build rows |
138 | 138 | $rowcount = $this->_isDataset ? $modx->db->getRecordCount($this->ds) : count($this->ds); |
139 | 139 | $this->_fieldnames = explode(",", $this->fields); |
140 | - if($rowcount == 0) { |
|
141 | - $tblRows .= "<tr><td " . $this->_itemStyle . " " . $this->_itemClass . " colspan='" . $this->_colcount . "'>" . $this->noRecordMsg . "</td></tr>\n"; |
|
140 | + if ($rowcount == 0) { |
|
141 | + $tblRows .= "<tr><td ".$this->_itemStyle." ".$this->_itemClass." colspan='".$this->_colcount."'>".$this->noRecordMsg."</td></tr>\n"; |
|
142 | 142 | } else { |
143 | 143 | // render grid items |
144 | - if($this->pageSize <= 0) { |
|
145 | - for($r = 0; $r < $rowcount; $r++) { |
|
144 | + if ($this->pageSize <= 0) { |
|
145 | + for ($r = 0; $r < $rowcount; $r++) { |
|
146 | 146 | $row = $this->_isDataset ? $modx->db->getRow($this->ds) : $this->ds[$r]; |
147 | 147 | $tblRows .= $this->RenderRowFnc($r + 1, $row); |
148 | 148 | } |
149 | 149 | } else { |
150 | - if(!$this->pager) { |
|
151 | - include_once dirname(__FILE__) . "/datasetpager.class.php"; |
|
150 | + if (!$this->pager) { |
|
151 | + include_once dirname(__FILE__)."/datasetpager.class.php"; |
|
152 | 152 | $this->pager = new DataSetPager($this->id, $this->ds, $this->pageSize, $this->pageNumber); |
153 | 153 | $this->pager->setRenderRowFnc($this); // pass this object |
154 | 154 | $this->pager->cssStyle = $pagerStyle; |
@@ -168,18 +168,18 @@ discard block |
||
168 | 168 | $o = $tblStart; |
169 | 169 | $ptop = (substr($this->pagerLocation, 0, 3) == "top") || (substr($this->pagerLocation, 0, 4) == "both"); |
170 | 170 | $pbot = (substr($this->pagerLocation, 0, 3) == "bot") || (substr($this->pagerLocation, 0, 4) == "both"); |
171 | - if($this->header) { |
|
172 | - $o .= "<tr><td bgcolor='#ffffff' colspan='" . $this->_colcount . "'>" . $this->header . "</td></tr>"; |
|
171 | + if ($this->header) { |
|
172 | + $o .= "<tr><td bgcolor='#ffffff' colspan='".$this->_colcount."'>".$this->header."</td></tr>"; |
|
173 | 173 | } |
174 | - if($tblPager && $ptop) { |
|
175 | - $o .= "<tr><td align='" . (substr($this->pagerLocation, -4) == "left" ? "left" : "right") . "' $pagerClass $pagerStyle colspan='" . $this->_colcount . "'>" . $tblPager . " </td></tr>"; |
|
174 | + if ($tblPager && $ptop) { |
|
175 | + $o .= "<tr><td align='".(substr($this->pagerLocation, -4) == "left" ? "left" : "right")."' $pagerClass $pagerStyle colspan='".$this->_colcount."'>".$tblPager." </td></tr>"; |
|
176 | 176 | } |
177 | - $o .= $tblColHdr . $tblRows; |
|
178 | - if($tblPager && $pbot) { |
|
179 | - $o .= "<tr><td align='" . (substr($this->pagerLocation, -4) == "left" ? "left" : "right") . "' $pagerClass $pagerStyle colspan='" . $this->_colcount . "'>" . $tblPager . " </td></tr>"; |
|
177 | + $o .= $tblColHdr.$tblRows; |
|
178 | + if ($tblPager && $pbot) { |
|
179 | + $o .= "<tr><td align='".(substr($this->pagerLocation, -4) == "left" ? "left" : "right")."' $pagerClass $pagerStyle colspan='".$this->_colcount."'>".$tblPager." </td></tr>"; |
|
180 | 180 | } |
181 | - if($this->footer) { |
|
182 | - $o .= "<tr><td bgcolor='#ffffff' colspan='" . $this->_colcount . "'>" . $this->footer . "</td></tr>"; |
|
181 | + if ($this->footer) { |
|
182 | + $o .= "<tr><td bgcolor='#ffffff' colspan='".$this->_colcount."'>".$this->footer."</td></tr>"; |
|
183 | 183 | } |
184 | 184 | $o .= $tblEnd; |
185 | 185 | return $o; |
@@ -187,8 +187,8 @@ discard block |
||
187 | 187 | |
188 | 188 | // format column values |
189 | 189 | |
190 | - function RenderRowFnc($n, $row) { |
|
191 | - if($this->_alt == 0) { |
|
190 | + function RenderRowFnc($n, $row){ |
|
191 | + if ($this->_alt == 0) { |
|
192 | 192 | $Style = $this->_itemStyle; |
193 | 193 | $Class = $this->_itemClass; |
194 | 194 | $this->_alt = 1; |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $this->_alt = 0; |
199 | 199 | } |
200 | 200 | $o = "<tr>"; |
201 | - for($c = 0; $c < $this->_colcount; $c++) { |
|
201 | + for ($c = 0; $c < $this->_colcount; $c++) { |
|
202 | 202 | $colStyle = $Style; |
203 | 203 | $fld = trim($this->_fieldnames[$c]); |
204 | 204 | $width = isset($this->_colwidths[$c]) ? $this->_colwidths[$c] : null; |
@@ -207,67 +207,67 @@ discard block |
||
207 | 207 | $type = isset($this->_coltypes[$c]) ? $this->_coltypes[$c] : null; |
208 | 208 | $nowrap = isset($this->_colwraps[$c]) ? $this->_colwraps[$c] : null; |
209 | 209 | $value = $row[($this->_isDataset && $fld ? $fld : $c)]; |
210 | - if($color && $Style) { |
|
211 | - $colStyle = substr($colStyle, 0, -1) . ";background-color:$color;'"; |
|
210 | + if ($color && $Style) { |
|
211 | + $colStyle = substr($colStyle, 0, -1).";background-color:$color;'"; |
|
212 | 212 | } |
213 | 213 | $value = $this->formatColumnValue($row, $value, $type, $align); |
214 | - $o .= "<td $colStyle $Class" . ($align ? " align='$align'" : "") . ($color ? " bgcolor='$color'" : "") . ($nowrap ? " nowrap='$nowrap'" : "") . ($width ? " width='$width'" : "") . ">$value</td>"; |
|
214 | + $o .= "<td $colStyle $Class".($align ? " align='$align'" : "").($color ? " bgcolor='$color'" : "").($nowrap ? " nowrap='$nowrap'" : "").($width ? " width='$width'" : "").">$value</td>"; |
|
215 | 215 | } |
216 | 216 | $o .= "</tr>\n"; |
217 | 217 | return $o; |
218 | 218 | } |
219 | 219 | |
220 | - function formatColumnValue($row, $value, $type, &$align) { |
|
221 | - if(strpos($type, ":") !== false) { |
|
220 | + function formatColumnValue($row, $value, $type, &$align){ |
|
221 | + if (strpos($type, ":") !== false) { |
|
222 | 222 | list($type, $type_format) = explode(":", $type, 2); |
223 | 223 | } |
224 | - switch(strtolower($type)) { |
|
224 | + switch (strtolower($type)) { |
|
225 | 225 | case "integer": |
226 | - if($align == "") { |
|
226 | + if ($align == "") { |
|
227 | 227 | $align = "right"; |
228 | 228 | } |
229 | 229 | $value = number_format($value); |
230 | 230 | break; |
231 | 231 | |
232 | 232 | case "float": |
233 | - if($align == "") { |
|
233 | + if ($align == "") { |
|
234 | 234 | $align = "right"; |
235 | 235 | } |
236 | - if(!$type_format) { |
|
236 | + if (!$type_format) { |
|
237 | 237 | $type_format = 2; |
238 | 238 | } |
239 | 239 | $value = number_format($value, $type_format); |
240 | 240 | break; |
241 | 241 | |
242 | 242 | case "currency": |
243 | - if($align == "") { |
|
243 | + if ($align == "") { |
|
244 | 244 | $align = "right"; |
245 | 245 | } |
246 | - if(!$type_format) { |
|
246 | + if (!$type_format) { |
|
247 | 247 | $type_format = 2; |
248 | 248 | } |
249 | - $value = "$" . number_format($value, $type_format); |
|
249 | + $value = "$".number_format($value, $type_format); |
|
250 | 250 | break; |
251 | 251 | |
252 | 252 | case "date": |
253 | - if($align == "") { |
|
253 | + if ($align == "") { |
|
254 | 254 | $align = "right"; |
255 | 255 | } |
256 | - if(!is_numeric($value)) { |
|
256 | + if (!is_numeric($value)) { |
|
257 | 257 | $value = strtotime($value); |
258 | 258 | } |
259 | - if(!$type_format) { |
|
259 | + if (!$type_format) { |
|
260 | 260 | $type_format = "%A %d, %B %Y"; |
261 | 261 | } |
262 | 262 | $value = strftime($type_format, $value); |
263 | 263 | break; |
264 | 264 | |
265 | 265 | case "boolean": |
266 | - if($align == '') { |
|
266 | + if ($align == '') { |
|
267 | 267 | $align = "center"; |
268 | 268 | } |
269 | 269 | $value = number_format($value); |
270 | - if($value) { |
|
270 | + if ($value) { |
|
271 | 271 | $value = '•'; |
272 | 272 | } else { |
273 | 273 | $value = ' '; |
@@ -278,8 +278,8 @@ discard block |
||
278 | 278 | // replace [+value+] first |
279 | 279 | $value = str_replace("[+value+]", $value, $type_format); |
280 | 280 | // replace other [+fields+] |
281 | - if(strpos($value, "[+") !== false) { |
|
282 | - foreach($row as $k => $v) { |
|
281 | + if (strpos($value, "[+") !== false) { |
|
282 | + foreach ($row as $k => $v) { |
|
283 | 283 | $value = str_replace("[+$k+]", $v, $value); |
284 | 284 | } |
285 | 285 | } |