Conditions | 3 |
Paths | 11 |
Total Lines | 22 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
1 | <?php |
||
35 | public function getAction() |
||
36 | { |
||
37 | $response = array( |
||
38 | 'success' => 0 |
||
39 | ); |
||
40 | $channels = array(); |
||
41 | try { |
||
42 | $list = Mage::getModel('slack/api_channels')->list(); |
||
43 | foreach ($list->getChannels() as $channel) { |
||
44 | $channels[$channel['id']] = $channel['name']; |
||
45 | } |
||
46 | Mage::getSingleton('slack/config_settings')->setChannels($channels); |
||
47 | $response = array( |
||
48 | 'success' => 1, |
||
49 | 'html' => $this->getLayout()->createBlock('slack/adminhtml_system_config_channels_list')->toHtml() |
||
50 | ); |
||
51 | } catch (Exception $e) { |
||
52 | Mage::logException($e); |
||
53 | } |
||
54 | $this->getResponse()->clearHeaders()->setHeader('Content-type', ' application/json', true); |
||
55 | $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response)); |
||
56 | } |
||
57 | } |
||
58 |