예제 #1
0
파일: users.php 프로젝트: fracting/cmc
 /**
  * Delete users
  *
  * @throws Exception
  *
  * @return void
  */
 public function delete()
 {
     $input = JFactory::getApplication()->input;
     $cid = $input->get('cid', array(), 'array');
     $params = JComponentHelper::getParams('com_cmc');
     $api_key = $params->get("api_key", '');
     $db = JFactory::getDBO();
     if (count($cid)) {
         for ($i = 0; $i < count($cid); $i++) {
             $query = "SELECT * FROM #__cmc_users WHERE id = '" . $cid[$i] . "'";
             $db->setQuery($query);
             $member = $db->loadObject();
             try {
                 CmcHelperBasic::unsubscribeList($member);
             } catch (Exception $e) {
                 // Catching the case where the user is already unsubscribed from mailchimp
                 if ($e->getCode() != 232) {
                     throw $e;
                 }
             }
         }
         $cids = implode(',', $cid);
         $query = "DELETE FROM #__cmc_users where id IN ( {$cids} )";
         $db->setQuery($query);
         try {
             $db->execute();
         } catch (Exception $e) {
             JFactory::getApplication()->enqueueMessage($e->getMessage());
         }
     }
     $this->setRedirect('index.php?option=com_cmc&view=users');
 }
예제 #2
0
파일: cmclistid.php 프로젝트: fracting/cmc
 /**
  * Get the options
  *
  * @return array
  */
 protected function getOptions()
 {
     $lists = CmcHelperBasic::getLists();
     $input = JFActory::getApplication()->input;
     $list_options = array();
     foreach ($lists as $list) {
         $list_options[] = JHTML::_('select.option', $list->mc_id, $list->list_name);
     }
     if ($input->get('filter_list')) {
         $this->value = $input->get('filter_list');
     }
     return $list_options;
 }
예제 #3
0
파일: view.html.php 프로젝트: fracting/cmc
 /**
  * Displays the view
  *
  * @param   string  $tpl  - custom template
  *
  * @return mixed|void
  */
 public function display($tpl = null)
 {
     $this->items = $this->get('Items');
     $this->state = $this->get('state');
     $this->status = $this->get('status');
     $this->pagination = $this->get('Pagination');
     $lists = CmcHelperBasic::getLists();
     $options[] = array('value' => '', 'text' => JText::_('JALL'));
     foreach ($lists as $list) {
         $this->listNames[$list->mc_id] = $list->list_name;
         $options[] = array('value' => $list->mc_id, 'text' => $list->list_name);
     }
     $this->lists = JHtml::_('select.genericlist', $options, 'filter_list', 'onchange="this.form.submit()"', 'value', 'text', $this->state->get('filter.list'));
     array_shift($options);
     $this->addToList = JHtml::_('select.genericlist', $options, 'addtolist', '', 'value', 'text', $this->state->get('filter.list'));
     $this->addToolbar();
     parent::display($tpl);
 }
예제 #4
0
파일: default.php 프로젝트: fracting/cmc
                }
            });
		});
	})(jQuery);
</script>

<?php 
if ($this->updateStats) {
    ?>
    <script type="text/javascript">
        (function($) {
            $(document).ready(function(){
                $.ajax('index.php?option=com_cmc&task=stats.send&tmpl=component&<?php 
    echo JSession::getFormToken();
    ?>
=1', {
                    dataType: 'json',
                    success: function(msg) {}
                });
            });
        })(jQuery);
    </script>
<?php 
}
?>


<?php 
// Show Footer
echo CompojoomHtmlCTemplate::getFooter(CmcHelperBasic::footer());