/**
  * Draws the user profile tab "Subscriptions" (if enabled, user is the profile owner, and something to display.
  * 
  * @param  string      $plansTitle
  * @param  string      $htmlPlans
  * @return array|null
  */
 public function drawRegistrationPlans($plansTitle, $htmlPlans)
 {
     $this->plansTitle = $plansTitle;
     $this->htmlPlans = $htmlPlans;
     $htmlValue = $this->display();
     $description = null;
     $uniqueId = 'cbregplans';
     $displayOnTwoLines = cbpaidApp::settingsParams()->get('regDisplayLines', 2) == 2;
     $tab = $this->_model;
     if ($htmlValue) {
         return array(cbTabs::_createPseudoField($tab, $this->plansTitle, $htmlValue, $description, $uniqueId, $displayOnTwoLines));
     } else {
         return null;
     }
 }
Esempio n. 2
0
 /**
  * Generates the HTML to display the registration tab/area
  * @param  moscomprofilerTab   $tab       the tab database entry
  * @param  moscomprofilerUser  $user      the user being displayed
  * @param  int                 $ui        1 for front-end, 2 for back-end
  * @param  array               $postdata  _POST data for saving edited tab content as generated with getEditTab
  * @return mixed                          either string HTML for tab content, or false if ErrorMSG generated
  */
 function getDisplayRegistration($tab, $user, $ui, $postdata)
 {
     global $my, $_CB_framework, $_POST, $mainframe;
     // $mainframe needed by the require
     $return = null;
     if ($this->_CheckYancInstalled()) {
         require_once $_CB_framework->getCfg('absolute_path') . _NEWSLETTERFILE;
         $newslettersSubscriptions = new YancSubscription();
         $params = $this->params;
         $newslettersRegList = $params->get('newslettersRegList');
         $listsArray = isset($newslettersRegList) ? explode("|*|", $newslettersRegList) : null;
         $lists = $newslettersSubscriptions->getLists($my, $listsArray);
         if (count($lists) > 0) {
             $postedLists = cbGetParam($_POST, 'newsLitems', array(0));
             $postedHtml = cbGetParam($_POST, 'newsLhtml', 1);
             $lists[0]->receive_html = $postedHtml;
             for ($i = 0, $n = count($lists); $i < $n; $i++) {
                 $lists[$i]->subscribed = in_array($lists[$i]->id, $postedLists);
                 $lists[$i]->confirmed = $lists[$i]->subscribed;
                 // avoid display "not confirmed" on registration server-validation error.
             }
             $htmlValue = $this->_getFormattedNewsletters($lists, true, _UE_NEWSLETTER_NAME_REG, _UE_NEWSLETTER_DESCRIPTION_REG);
             $return = array(cbTabs::_createPseudoField($tab, rtrim(_UE_NEWSLETTER_SUBSCRIBE, ':'), $htmlValue, _UE_NEWSLETTER_DESCRIPTION_REG, 'cbregNewsletter', false));
         }
     }
     return $return;
 }