예제 #1
0
파일: list.php 프로젝트: fracting/cmc
 /**
  * Create an array with mailchimps interest fields
  *
  * @param   string  $listId  - the list id
  *
  * @return array|bool
  */
 public static function getInterestsFields($listId)
 {
     $api = new cmcHelperChimp();
     $interests = $api->listInterestGroupings($listId);
     $key = 'id';
     $val = 'name';
     $options = false;
     if ($interests) {
         foreach ($interests as $interest) {
             if ($interest['form_field'] != 'hidden') {
                 $groups = '';
                 foreach ($interest['groups'] as $ig) {
                     $groups .= $ig['name'] . '##' . $ig['name'] . '####';
                 }
                 $groups = substr($groups, 0, -4);
                 $options[] = array($key => $interest[$key] . ';' . $interest['form_field'] . ';' . $interest['name'] . ';' . $groups, $val => $interest[$val]);
             }
         }
     }
     return $options;
 }
예제 #2
0
파일: cmc.php 프로젝트: fracting/cmc
 /**
  * Loads the interests
  *
  * @return  mixed|string
  */
 public function loadInterests()
 {
     $plugin = GetCmcTab::getPlugin();
     $listid = $plugin->params->get('listid', "");
     if (empty($listid)) {
         $content = '<div style="float:left;">' . JText::_('PLG_CMCCB_NO_INTEREST_GROUPS') . '</div>';
         return $content;
     }
     $api = new cmcHelperChimp();
     $interests = $api->listInterestGroupings($listid);
     $key = 'id';
     $val = 'name';
     $options = false;
     if ($interests) {
         foreach ($interests as $interest) {
             if ($interest['form_field'] != 'hidden') {
                 $groups = '';
                 foreach ($interest['groups'] as $ig) {
                     $groups .= $ig['name'] . '##' . $ig['name'] . '####';
                 }
                 $groups = substr($groups, 0, -4);
                 $options[] = array($key => $interest[$key] . ';' . $interest['form_field'] . ';' . $interest['name'] . ';' . $groups, $val => $interest[$val]);
             }
         }
     }
     $attribs = 'multiple="multiple" size="8"';
     if ($options) {
         $content = JHtml::_('select.genericlist', $options, 'params[interests][]', $attribs, $key, $val, explode("|*|", $plugin->params->get('interests', "")));
     } else {
         $content = '<div style="float:left;">' . JText::_('PLG_CMCCB_NO_INTEREST_GROUPS') . '</div>';
     }
     return $content;
 }