Changeset 1320
- Timestamp:
- 01/09/08 16:49:58 (11 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wifidog-auth/CHANGELOG
r1316 r1320 1 1 # $Id$ 2 2008-01-09 Benoit Grégoire <bock@step.polymtl.ca> 3 * Add gettext calls, fixes #413 4 2 5 2008-01-06 Benoit Grégoire <bock@step.polymtl.ca> 3 6 * Some more work on the permission system. At long last, close #358 trunk/wifidog-auth/wifidog/classes/Content/BannerAdGroup/BannerAdGroup.php
r1249 r1320 135 135 /*max_width*/ 136 136 $html .= "<li class='admin_element_item_container'>\n"; 137 $html .= "<div class='admin_element_label'>" . ("Width") . ": </div>\n";137 $html .= "<div class='admin_element_label'>" . _("Width") . ": </div>\n"; 138 138 $html .= "<div class='admin_element_data'>\n"; 139 139 $name = "banner_add_group_{this->getId()}_max_width"; … … 144 144 /*max_height*/ 145 145 $html .= "<li class='admin_element_item_container'>\n"; 146 $html .= "<div class='admin_element_label'>" . ("Height") . ": </div>\n";146 $html .= "<div class='admin_element_label'>" . _("Height") . ": </div>\n"; 147 147 $html .= "<div class='admin_element_data'>\n"; 148 148 $name = "banner_add_group_{this->getId()}_max_height"; trunk/wifidog-auth/wifidog/classes/Content/ContentGroup/ContentGroup.php
r1249 r1320 59 59 */ 60 60 class ContentGroup extends Content { 61 62 private $CONTENT_ORDERING_MODES = array ( 63 'RANDOM' => "Pick content elements randomly", 64 'PSEUDO_RANDOM' => "Pick content elements randomly, but not twice until all elements have been seen", 65 'SEQUENTIAL' => "Pick content elements in sequential order" 66 ); 67 private $CONTENT_CHANGES_ON_MODES = array ( 68 'ALWAYS' => "Content always rotates", 69 'NEXT_DAY' => "Content rotates once per day", 70 'NEXT_LOGIN' => "Content rotates once per session", 71 'NEXT_NODE' => "Content rotates each time you change node", 72 'NEVER' => "Content never rotates. Usefull when showing all elements simultaneously in a specific order." 73 ); 74 private $ALLOW_REPEAT_MODES = array ( 75 'YES' => "Content can be shown more than once", 76 'NO' => "Content can only be shown once", 77 'ONCE_PER_NODE' => "Content can be shown more than once, but not at the same node" 78 ); 61 /** See contructor for value */ 62 private $CONTENT_ORDERING_MODES; 63 /** See contructor for value */ 64 private $CONTENT_CHANGES_ON_MODES; 65 /** See contructor for value */ 66 private $ALLOW_REPEAT_MODES; 79 67 80 68 // is_expandable is ONLY for internal use, it use normally only set by the constructor … … 95 83 // Init values 96 84 $row = null; 97 98 85 parent :: __construct($content_id); 86 $this->CONTENT_ORDERING_MODES = array ( 87 'RANDOM' => _("Pick content elements randomly"), 88 'PSEUDO_RANDOM' => _("Pick content elements randomly, but not twice until all elements have been seen"), 89 'SEQUENTIAL' => _("Pick content elements in sequential order") 90 ); 91 $this->CONTENT_CHANGES_ON_MODES = array ( 92 'ALWAYS' => _("Content always rotates"), 93 'NEXT_DAY' => _("Content rotates once per day"), 94 'NEXT_LOGIN' => _("Content rotates once per session"), 95 'NEXT_NODE' => _("Content rotates each time you change node"), 96 'NEVER' => _("Content never rotates. Usefull when showing all elements simultaneously in a specific order.") 97 ); 98 $this->ALLOW_REPEAT_MODES = array ( 99 'YES' => _("Content can be shown more than once"), 100 'NO' => _("Content can only be shown once"), 101 'ONCE_PER_NODE' => _("Content can be shown more than once, but not at the same node") 102 ); 99 103 100 104 $content_id = $db->escapeString($content_id); … … 121 125 122 126 /** Set the allowed content types for the group, 123 * @param $allowed_content_types ContentTypeFilter*/127 * @param $allowed_content_types ContentTypeFilter*/ 124 128 public function setAllowedContentTypes(ContentTypeFilter $allowed_content_types) { 125 129 $this->allowed_content_types = $allowed_content_types; … … 128 132 129 133 /** In what order is the content displayed to the user 130 * @return string, a key of CONTENT_SELECTION_MODES */134 * @return string, a key of CONTENT_SELECTION_MODES */ 131 135 public function getContentOrderingMode() { 132 136 return $this->content_group_row['content_ordering_mode']; … … 157 161 158 162 /** When does the content rotate? 159 * @return string, a key of CONTENT_SELECTION_MODES */163 * @return string, a key of CONTENT_SELECTION_MODES */ 160 164 public function getContentChangesOnMode() { 161 165 return $this->content_group_row['content_changes_on_mode']; … … 215 219 216 220 /** How many element should be picked for display at once? 217 * @return integer */221 * @return integer */ 218 222 public function getDisplayNumElements() { 219 223 if ($this->temporary_display_num_elements == null) 220 return $this->content_group_row['display_num_elements'];224 return $this->content_group_row['display_num_elements']; 221 225 else 222 return $this->temporary_display_num_elements;226 return $this->temporary_display_num_elements; 223 227 } 224 228 225 229 /** How many element should be picked for display at once? 226 * @param $display_num_elements integer, must be greater than zero.227 * @return true if successfull228 * */230 * @param $display_num_elements integer, must be greater than zero. 231 * @return true if successfull 232 * */ 229 233 protected function setDisplayNumElements($display_num_elements, & $errormsg = null) { 230 234 $retval = false; … … 289 293 /*display_num_elements*/ 290 294 $html .= "<li class='admin_element_item_container'>\n"; 291 $html .= "<div class='admin_element_label'>" . ("Pick how many elements for each display?") . ": </div>\n";295 $html .= "<div class='admin_element_label'>" . _("Pick how many elements for each display?") . ": </div>\n"; 292 296 $html .= "<div class='admin_element_data'>\n"; 293 297 $name = "content_group_" . $this->id . "_display_num_elements"; … … 324 328 $name = "content_group_" . $this->id . "_expired_elements_shown"; 325 329 $html .= "<input type='hidden' name='$name' id='$name' value='$showExpired'>\n"; 326 330 327 331 $html .= "<ul class='admin_element_list'>\n"; 328 332 foreach ($this->getElements($additionalWhere) as $element) { … … 371 375 372 376 /* content_group_element */ 373 $name = "content_group_" . $this->id . "_expired_elements_shown";374 if (empty ($_REQUEST[$name])) {375 $additionalWhere = "AND (valid_until_timestamp IS NULL OR valid_until_timestamp >= CURRENT_TIMESTAMP) \n";376 } else {377 $additionalWhere = null;378 }377 $name = "content_group_" . $this->id . "_expired_elements_shown"; 378 if (empty ($_REQUEST[$name])) { 379 $additionalWhere = "AND (valid_until_timestamp IS NULL OR valid_until_timestamp >= CURRENT_TIMESTAMP) \n"; 380 } else { 381 $additionalWhere = null; 382 } 379 383 foreach ($this->getElements($additionalWhere) as $element) { 380 384 $name = "content_group_" . $this->id . "_element_" . $element->GetId() . "_erase"; … … 415 419 416 420 /**Get the next element or elements to be displayed, depending on the display mode 417 * @return an array of ContentGroupElement or an empty arrray */421 * @return an array of ContentGroupElement or an empty arrray */ 418 422 function getDisplayElements() { 419 423 //This function is very expensive, cache the results … … 477 481 $object = self :: getObject($redisplay_row['content_group_element_id']); 478 482 if ($object->isDisplayableAt(Node :: GetCurrentNode()) == true) /** Only content available at this hotspot are considered */ 479 {483 { 480 484 $redisplay_objects[] = $object; 481 485 } … … 550 554 $object = self :: getObject($element_row['content_group_element_id']); 551 555 if ($object->isDisplayableAt(Node :: GetCurrentNode()) == true) /** Only content available at this hotspot are considered */ 552 {556 { 553 557 $new_objects[] = $object; 554 558 } … … 571 575 $new_objects = array_slice($new_objects, 0, $num_to_pick); 572 576 } 573 577 574 578 /*echo "<pre>Redisplay: "; 575 print_r($redisplay_objects);576 echo "New objects: ";577 print_r($new_objects);578 echo "</pre>";*/579 579 print_r($redisplay_objects); 580 echo "New objects: "; 581 print_r($new_objects); 582 echo "</pre>";*/ 583 580 584 $retval = array_merge($new_objects, $redisplay_objects); 581 585 //echo count($retval).' returned <br>'; … … 592 596 protected function setIsExpandable($status) { 593 597 if (is_bool($status)) 594 $this->is_expandable = $status;598 $this->is_expandable = $status; 595 599 } 596 600 … … 610 614 //TODO: Try to find a better solution to this problem... 611 615 if ($status == true) 612 $this->setTemporaryDisplayNumElements(3000);616 $this->setTemporaryDisplayNumElements(3000); 613 617 else 614 $this->setTemporaryDisplayNumElements(null);618 $this->setTemporaryDisplayNumElements(null); 615 619 $this->expand_status = $status; 616 620 } … … 625 629 public function getExpandStatus() { 626 630 if ($this->expand_status == null) 627 return false;631 return false; 628 632 return $this->expand_status; 629 633 } … … 655 659 // If the content group logging is disabled, all the children will inherit this property temporarly 656 660 if ($this->getLoggingStatus() == false) 657 $display_element->setLoggingStatus(false);661 $display_element->setLoggingStatus(false); 658 662 $html .= $display_element->getUserUI(); 659 663 } … … 662 666 } 663 667 } 664 $this->setUserUIMainDisplayContent($html);668 $this->setUserUIMainDisplayContent($html); 665 669 return parent :: getUserUI(); 666 670 } … … 697 701 698 702 /** Reloads the object from the database. Should normally be called after a set operation. 699 * This function is private because calling it from a subclass will call the700 * constructor from the wrong scope */703 * This function is private because calling it from a subclass will call the 704 * constructor from the wrong scope */ 701 705 private function refresh() { 702 706 $this->__construct($this->id);
