/**
  * Retrieves all active MOTDs.
  *
  * @return array
  * An associative array containing the details of the active MOTDs, or null
  * if there are no active MOTDs.
  */
 public function getActiveMotds()
 {
     $returnArray = array();
     //Retrieve all MOTDs.
     $motds = new Datasource_Cms_Connect_Motd();
     $motdsArray = $motds->getAll();
     foreach ($motdsArray as $currentMotd) {
         if ($currentMotd['active'] == 1) {
             //Ensure the today is captured in the MOTD date range.
             $displayFrom = new Zend_Date($currentMotd['displayFrom'], Zend_Date::ISO_8601);
             $displayTo = new Zend_Date($currentMotd['displayTo'], Zend_Date::ISO_8601);
             $now = Zend_Date::now();
             if ($displayFrom->isToday() || $displayTo->isToday()) {
                 $returnArray[] = $currentMotd;
             } else {
                 if ($now->isLater($displayFrom) && $now->isEarlier($displayTo)) {
                     $returnArray[] = $currentMotd;
                 }
             }
         }
     }
     //Clean up the return value consistent with this function's contract.
     if (empty($returnArray)) {
         $returnVal = null;
     } else {
         $returnVal = $returnArray;
     }
     return $returnVal;
 }
 /**
  * Controls the MOTD summary page.
  */
 public function motdAction()
 {
     $this->view->currentPage = 'connectMotd';
     $motds = new Datasource_Cms_Connect_Motd();
     $motdsArray = $motds->getAll();
     //Separate the active motd from the inactive.
     $activeMotd = array();
     $inactiveMotds = array();
     foreach ($motdsArray as $currentMotd) {
         if ($currentMotd['active'] == 1) {
             $activeMotd[] = $currentMotd;
         } else {
             $inactiveMotds[] = $currentMotd;
         }
     }
     $this->view->connectMotdActive = $this->view->partialLoop('partials/connect-motd-row.phtml', $activeMotd);
     $this->view->connectMotdInactiveList = $this->view->partialLoop('partials/connect-motd-row.phtml', $inactiveMotds);
     $passThrough = $this->_helper->getHelper('FlashMessenger')->getMessages();
     if (count($passThrough) > 0) {
         if (isset($passThrough[0]['saved'])) {
             if ($passThrough[0]['saved'] == true) {
                 $this->view->saved = true;
             }
         }
         if (isset($passThrough[0]['deleted'])) {
             if ($passThrough[0]['deleted'] == true) {
                 $this->view->deleted = true;
             }
         }
         if (isset($passThrough[0]['activated'])) {
             if ($passThrough[0]['activated'] == true) {
                 $this->view->activated = true;
             }
         }
         if (isset($passThrough[0]['deactivated'])) {
             if ($passThrough[0]['deactivated'] == true) {
                 $this->view->deactivated = true;
             }
         }
         if (isset($passThrough[0]['errorMessage'])) {
             $this->view->errorMessage = $passThrough[0]['errorMessage'];
         }
     }
 }