Esempio n. 1
0
 protected function getCurrentTheme()
 {
     $companyMapper = new Admin_Model_CompanyMapper();
     $company = $companyMapper->find(Zend_Controller_Action_HelperBroker::getStaticHelper('config')->direct('application')->companyid);
     if (!$this->_mapper->findByName($company->getSelected_theme())) {
         $this->changeSelectedTheme('LoveMachine');
     }
     return $this->_mapper->findByName($company->getSelected_theme());
 }
Esempio n. 2
0
 public function indexAction()
 {
     $companyMapper = new Admin_Model_CompanyMapper();
     $this->view->company = $companyMapper->find($this->getCompanyId());
     $this->view->fonts = array('Times New Roman', 'Georgia', 'Andale Mono', 'Arial', 'Arial Black', 'Century Gothic', 'Impact', 'Trebuchet MS', 'Verdana', 'Comic Sans MS', 'Courier New');
     $this->view->weekdays = array(0 => 'Sunday', 1 => 'Monday', 2 => 'Tuesday', 3 => 'Wednesday', 4 => 'Thursday', 5 => 'Friday', 6 => 'Saturday');
     $this->view->hours = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23);
     $this->view->minutes = array(0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55);
     $weeklyupdates = Zend_Json::decode($this->_helper->api(array('action' => 'getWeeklyUpdates', 'api_key' => $this->_helper->api->key('love')), $this->_helper->api->endpoint('love')));
     if ($weeklyupdates['success'] == true) {
         $this->view->weeklyupdates = $weeklyupdates['settings'];
     }
     $themesMapper = new Admin_Model_ThemesMapper();
     $this->view->themes = $themesMapper->fetchAll();
     $this->view->theme = $this->_helper->theme();
 }
Esempio n. 3
0
 public function addAction($email = null)
 {
     $this->_helper->viewRenderer->setNoRender(true);
     $validator = new Zend_Validate_EmailAddress();
     if ($validator->isValid($this->getRequest()->getParam('email'))) {
         $splitEmail = explode('@', $this->getRequest()->getParam('email'));
         $password = Sendlove_Utilities::createPassword();
         $token = uniqid();
         $login = Zend_Json::decode($this->_helper->api(array('app' => $this->_helper->api->name('login'), 'key' => $this->_helper->api->key('login'), 'token' => $token, 'admin_id' => $this->getSession()->userid, 'user_data' => array(array('username' => $this->getRequest()->getParam('email'), 'password' => $password, 'nickname' => $splitEmail[0], 'Active' => 1, 'Confirmed' => 1, 'status' => 'new'))), $this->_helper->api->endpoint('login') . 'admincreateusers'));
         if ($login['error'] == 0) {
             if ($login['token'] == $token) {
                 if ($this->getRequest()->getParam('sendlove')) {
                     $love = new Sendlove_Love();
                     $love->sendLove($this->getLoveEmail(), $this->getSession()->username, 'Welcome to SendLove');
                 }
                 $companyMapper = new Admin_Model_CompanyMapper();
                 $company = $companyMapper->find($this->_helper->config('application')->companyid);
                 if (!$this->sendCreateMail(array('creator_nickname' => $this->getSession()->nickname, 'creator_email' => $this->getSession()->username, 'company_name' => $company->getCompany_name(), 'url' => $this->_helper->config('application')->loveLoginUrl, 'user_username' => $this->getRequest()->getParam('email'), 'user_password' => $password))) {
                     throw new Exception('Email could not be sent!');
                 }
                 // Get the user data
                 $user = $login['0'][0];
                 $newUsers[] = array('id' => $user['id'], 'username' => $user['username'], 'nickname' => $user['nickname'], 'active' => 1, 'confirmed' => 1);
                 echo Zend_Json::encode(array('success' => true, 'message' => 'User successfully added', 'users' => $newUsers));
             } else {
                 echo Zend_Json::encode(array('success' => false, 'message' => $login['message']));
             }
         } else {
             echo Zend_Json::encode(array('success' => false, 'message' => 'Could not add the user.'));
         }
     } else {
         echo Zend_Json::encode(array('success' => false, 'message' => 'No valid email address.'));
     }
 }