Skip to content

Instantly share code, notes, and snippets.

@objectivehtml
Created December 29, 2011 15:56
Show Gist options
  • Save objectivehtml/1534699 to your computer and use it in GitHub Desktop.
Save objectivehtml/1534699 to your computer and use it in GitHub Desktop.
Simple EE Class interacting with Channel Data
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Email_Template {
public $to,
$from,
$cc,
$bcc,
$channel_id,
$categories,
$status,
$member_group,
$subject,
$message,
$settings;
public function __construct($data = FALSE)
{
$this->EE =& get_instance();
if(!$data)
{
$channel = $this->EE->channel_data->get_channels(array(
'order_by' => 'channel_name',
'sort' => 'ASC',
'limit' => 1
));
if($channel->num_rows() > 0)
{
$channel_id = $channel->row('id');
}
}
}
public function channels()
{
$channels = $this->EE->channel_data->get_channels(array(
'order_by' => 'channel_name',
'sort' => 'ASC'
));
return $channels->result();
}
public function statuses()
{
$statuses = $this->EE->channel_data->get_channel_statuses($this->channel_id, array(
'sort' => 'ASC'
));
return $statuses->result();
}
public function member_groups()
{
$member_groups = $this->EE->channel_data->get_member_groups(array(
'order_by' => 'group_id',
'sort' => 'ASC'
));
return $member_groups->result();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment