Rev 277 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 277 | Rev 360 | ||
---|---|---|---|
Line 30... | Line 30... | ||
30 | if ($namespace !== 'gs1') return false; |
30 | if ($namespace !== 'gs1') return false; |
31 | return new self($number); |
31 | return new self($number); |
32 | } |
32 | } |
33 | 33 | ||
34 | public static function objectTypeTitle() { |
34 | public static function objectTypeTitle() { |
35 | return "GS1 Based IDs (GLN/GTIN/SSCC/...)"; |
35 | return _L('GS1 Based IDs (GLN/GTIN/SSCC/...)'); |
36 | } |
36 | } |
37 | 37 | ||
38 | public static function objectTypeTitleShort() { |
38 | public static function objectTypeTitleShort() { |
39 | return "GS1"; |
39 | return _L('GS1'); |
40 | } |
40 | } |
41 | 41 | ||
42 | public static function ns() { |
42 | public static function ns() { |
43 | return 'gs1'; |
43 | return 'gs1'; |
44 | } |
44 | } |
Line 55... | Line 55... | ||
55 | return $with_ns ? 'gs1:'.$this->number : $this->number; |
55 | return $with_ns ? 'gs1:'.$this->number : $this->number; |
56 | } |
56 | } |
57 | 57 | ||
58 | public function addString($str) { |
58 | public function addString($str) { |
59 | if (!preg_match('@^\\d+$@', $str, $m)) { |
59 | if (!preg_match('@^\\d+$@', $str, $m)) { |
60 | throw new OIDplusException('GS1 value needs to be numeric'); |
60 | throw new OIDplusException(_L('GS1 value needs to be numeric')); |
61 | } |
61 | } |
62 | 62 | ||
63 | return $this->nodeId() . $str; |
63 | return $this->nodeId() . $str; |
64 | } |
64 | } |
65 | 65 | ||
Line 90... | Line 90... | ||
90 | if ($this->isRoot()) { |
90 | if ($this->isRoot()) { |
91 | $title = OIDplusGs1::objectTypeTitle(); |
91 | $title = OIDplusGs1::objectTypeTitle(); |
92 | 92 | ||
93 | $res = OIDplus::db()->query("select * from ###objects where parent = ?", array(self::root())); |
93 | $res = OIDplus::db()->query("select * from ###objects where parent = ?", array(self::root())); |
94 | if ($res->num_rows() > 0) { |
94 | if ($res->num_rows() > 0) { |
95 | $content = 'Please select an item in the tree view at the left to show its contents.'; |
95 | $content = _L('Please select an item in the tree view at the left to show its contents.'); |
96 | } else { |
96 | } else { |
97 | $content = 'Currently, no GS1 based numbers are registered in the system.'; |
97 | $content = _L('Currently, no GS1 based numbers are registered in the system.'); |
98 | } |
98 | } |
99 | 99 | ||
100 | if (!$this->isLeafNode()) { |
100 | if (!$this->isLeafNode()) { |
101 | if (OIDplus::authUtils()::isAdminLoggedIn()) { |
101 | if (OIDplus::authUtils()::isAdminLoggedIn()) { |
102 | $content .= '<h2>Manage root objects</h2>'; |
102 | $content .= '<h2>'._L('Manage root objects').'</h2>'; |
103 | } else { |
103 | } else { |
104 | $content .= '<h2>Available objects</h2>'; |
104 | $content .= '<h2>'._L('Available objects').'</h2>'; |
105 | } |
105 | } |
106 | $content .= '%%CRUD%%'; |
106 | $content .= '%%CRUD%%'; |
107 | } |
107 | } |
108 | } else { |
108 | } else { |
109 | $title = $this->getTitle(); |
109 | $title = $this->getTitle(); |
110 | 110 | ||
111 | if ($this->isLeafNode()) { |
111 | if ($this->isLeafNode()) { |
112 | $chunked = $this->chunkedNotation(true); |
112 | $chunked = $this->chunkedNotation(true); |
113 | $checkDigit = $this->checkDigit(); |
113 | $checkDigit = $this->checkDigit(); |
114 | $content = '<h2>'.$chunked.' - <abbr title="check digit">'.$checkDigit.'</abbr></h2>'; |
114 | $content = '<h2>'.$chunked.' - <abbr title="'._L('check digit').'">'.$checkDigit.'</abbr></h2>'; |
115 | $content .= '<p><a target="_blank" href="https://www.ean-search.org/?q='.htmlentities($this->fullNumber()).'">Lookup in ean-search.org</a></p>'; |
115 | $content .= '<p><a target="_blank" href="https://www.ean-search.org/?q='.htmlentities($this->fullNumber()).'">'._L('Lookup at ean-search.org').'</a></p>'; |
116 | $content .= '<img src="plugins/objectTypes/'.basename(__DIR__).'/barcode.php?number='.urlencode($this->fullNumber()).'">'; |
116 | $content .= '<img src="plugins/objectTypes/'.basename(__DIR__).'/barcode.php?number='.urlencode($this->fullNumber()).'">'; |
117 | $content .= '<h2>Description</h2>%%DESC%%'; // TODO: add more meta information about the object type |
117 | $content .= '<h2>'._L('Description').'</h2>%%DESC%%'; // TODO: add more meta information about the object type |
118 | } else { |
118 | } else { |
119 | $chunked = $this->chunkedNotation(true); |
119 | $chunked = $this->chunkedNotation(true); |
120 | $content = '<h2>'.$chunked.'</h2>'; |
120 | $content = '<h2>'.$chunked.'</h2>'; |
121 | $content .= '<h2>Description</h2>%%DESC%%'; // TODO: add more meta information about the object type |
121 | $content .= '<h2>'._L('Description').'</h2>%%DESC%%'; // TODO: add more meta information about the object type |
122 | if ($this->userHasWriteRights()) { |
122 | if ($this->userHasWriteRights()) { |
123 | $content .= '<h2>Create or change subsequent objects</h2>'; |
123 | $content .= '<h2>'._L('Create or change subsequent objects').'</h2>'; |
124 | } else { |
124 | } else { |
125 | $content .= '<h2>Subsequent objects</h2>'; |
125 | $content .= '<h2>'._L('Subsequent objects').'</h2>'; |
126 | } |
126 | } |
127 | $content .= '%%CRUD%%'; |
127 | $content .= '%%CRUD%%'; |
128 | } |
128 | } |
129 | } |
129 | } |
130 | } |
130 | } |