diff options
author | Antonio Gallo <tonicucoz@gmail.com> | 2011-02-11 00:55:42 +0000 |
---|---|---|
committer | Antonio Gallo <tonicucoz@gmail.com> | 2011-02-11 00:55:42 +0000 |
commit | 51138d1c41d9be15d64d42bd25a46758d360ae4e (patch) | |
tree | cb7ad9c2d70f47e1769ad81d6a7aa8507d144df5 /h-source/Application/Include | |
parent | 1df7d5d81c9c60029dfd6291e95f67b466673edc (diff) |
improved actions history
Diffstat (limited to 'h-source/Application/Include')
-rw-r--r-- | h-source/Application/Include/languages.php | 14 | ||||
-rw-r--r-- | h-source/Application/Include/myFunctions.php | 69 |
2 files changed, 50 insertions, 33 deletions
diff --git a/h-source/Application/Include/languages.php b/h-source/Application/Include/languages.php index 0e0959a..40014b0 100644 --- a/h-source/Application/Include/languages.php +++ b/h-source/Application/Include/languages.php @@ -167,6 +167,12 @@ class Lang "Download the xml file of all the <b>webcams</b> in the database" => "Scarica il file xml di tutte le <b>webcams</b> presenti nel database", "You can download all the h-node database in one unique xml file in order to parse its contents by means of some proper script (for example a Python or Perl or PHP script)" => "Puoi scaricare l'intero database di h-node in un unico file xml per analizzarne i contenuti utilizzando uno script appropriato (ad esempio uno script Python o Perl o PHP)", "Download the h-node hardware database in xml format" => "Scarica il database dell'hardware di h-node in formato xml", + "Database modifications" => "Modifiche al database", + "List of the database modifications carried out by users" => "Lista delle modifiche apportate al database dagli utenti", + "the model" => "il modello", + "has been inserted by" => "è stato inserito da", + "has been updated by" => "è stato modificato da", + "at" => "alle ore", ), 'es' => array ( @@ -460,6 +466,14 @@ class Go { return "http://".DOMAIN_NAME."/".Hardware::getControllerFromType($type)."/insert/".Lang::$current; } + + //go to the page of one device from the id of that device + public static function toHardwarePage($idHard = 0) + { + $clean['idHard'] = (int)$idHard; + $urls = getUrlsFromIdHard($clean['idHard']); + return $urls['urlView']; + } } class MyStrings diff --git a/h-source/Application/Include/myFunctions.php b/h-source/Application/Include/myFunctions.php index 483a85f..daefb59 100644 --- a/h-source/Application/Include/myFunctions.php +++ b/h-source/Application/Include/myFunctions.php @@ -95,40 +95,40 @@ function getOrderByClause($string) function diff($old, $new){ - $maxlen = 0; - foreach($old as $oindex => $ovalue){ + $maxlen = 0; + foreach($old as $oindex => $ovalue){ // $nkeys = getNewKeys($new,$ovalue); - $nkeys = array_keys($new, $ovalue); - foreach($nkeys as $nindex){ - $matrix[$oindex][$nindex] = isset($matrix[$oindex - 1][$nindex - 1]) ? - $matrix[$oindex - 1][$nindex - 1] + 1 : 1; - if($matrix[$oindex][$nindex] > $maxlen){ - $maxlen = $matrix[$oindex][$nindex]; - $omax = $oindex + 1 - $maxlen; - $nmax = $nindex + 1 - $maxlen; - } - } - } - if($maxlen == 0) return array(array('d'=>$old, 'i'=>$new)); - return array_merge( - diff(array_slice($old, 0, $omax), array_slice($new, 0, $nmax)), - array_slice($new, $nmax, $maxlen), - diff(array_slice($old, $omax + $maxlen), array_slice($new, $nmax + $maxlen))); + $nkeys = array_keys($new, $ovalue); + foreach($nkeys as $nindex){ + $matrix[$oindex][$nindex] = isset($matrix[$oindex - 1][$nindex - 1]) ? + $matrix[$oindex - 1][$nindex - 1] + 1 : 1; + if($matrix[$oindex][$nindex] > $maxlen){ + $maxlen = $matrix[$oindex][$nindex]; + $omax = $oindex + 1 - $maxlen; + $nmax = $nindex + 1 - $maxlen; + } + } + } + if($maxlen == 0) return array(array('d'=>$old, 'i'=>$new)); + return array_merge( + diff(array_slice($old, 0, $omax), array_slice($new, 0, $nmax)), + array_slice($new, $nmax, $maxlen), + diff(array_slice($old, $omax + $maxlen), array_slice($new, $nmax + $maxlen))); } function htmlDiff($old, $new){ - $old = str_replace("\r\n"," \r\n ",$old); - $new = str_replace("\r\n"," \r\n ",$new); - - $ret = null; - $diff = diff(explode(' ', $old), explode(' ', $new)); - foreach($diff as $k){ - if(is_array($k)) - $ret .= (!empty($k['d'])?"<del>".implode(' ',$k['d'])."</del> ":''). - (!empty($k['i'])?"<ins>".implode(' ',$k['i'])."</ins> ":''); - else $ret .= $k . ' '; - } - return $ret; + $old = str_replace("\r\n"," \r\n ",$old); + $new = str_replace("\r\n"," \r\n ",$new); + + $ret = null; + $diff = diff(explode(' ', $old), explode(' ', $new)); + foreach($diff as $k){ + if(is_array($k)) + $ret .= (!empty($k['d'])?"<del>".implode(' ',$k['d'])."</del> ":''). + (!empty($k['i'])?"<ins>".implode(' ',$k['i'])."</ins> ":''); + else $ret .= $k . ' '; + } + return $ret; } @@ -457,16 +457,19 @@ function getUrlsFromIdHard($id_hard) $urlView = "http://".DOMAIN_NAME; $urlTalk = "http://".DOMAIN_NAME; + $deviceName = null; $hard = new HardwareModel(); $res = $hard->select('type,model')->where(array('id_hard'=>$clean['id_hard']))->send(); if (count($res) > 0) { - $urlView = "http://".DOMAIN_NAME."/".MyStrings::$reverse[$res[0]['hardware']['type']]."/view/".Lang::$current."/".$clean['id_hard']."/".encodeUrl($res[0]['hardware']['model']); + $urlView = "http://".DOMAIN_NAME."/".Hardware::$typeToController[$res[0]['hardware']['type']]."/view/".Lang::$current."/".$clean['id_hard']."/".encodeUrl($res[0]['hardware']['model']); - $urlTalk = "http://".DOMAIN_NAME."/".MyStrings::$reverse[$res[0]['hardware']['type']]."/talk/".Lang::$current."/".$clean['id_hard']; + $urlTalk = "http://".DOMAIN_NAME."/".Hardware::$typeToController[$res[0]['hardware']['type']]."/talk/".Lang::$current."/".$clean['id_hard']; + + $deviceName = $res[0]['hardware']['model']; } - return array('urlView'=>$urlView,'urlTalk'=>$urlTalk); + return array('urlView'=>$urlView,'urlTalk'=>$urlTalk,'modelName'=>$deviceName); }
\ No newline at end of file |