Example #1
0
 protected function handleEditValidationSuccess($banner, $site = '')
 {
     if ($banner->Id == NULL) {
         $uplPath = $this->config->item('resource_folder') . '/banner';
         $uplConfig['upload_path'] = $uplPath;
         $uplConfig['allowed_types'] = $this->config->item('img_allowed_type');
         $uplConfig['max_size'] = $this->config->item('img_max_size');
         $uplConfig['max_width'] = $this->config->item('img_max_width');
         $uplConfig['max_height'] = $this->config->item('img_max_height');
         $this->load->library('upload', $uplConfig);
         if ($this->upload->do_upload('imgBanner')) {
             $data = $this->upload->data();
             $resource = new Resource_model();
             $resource->Path = $uplPath . '/' . $data['file_name'];
             $resourceId = $resource->save();
         } else {
             $this->addDataForView('err', $this->upload->display_errors('<div>', '</div>'));
             $this->template->load($this->template_admin, $this->getEditViewName(), $this->getDataForView());
             return;
         }
         if (isset($resourceId)) {
             $banner->IdResource = $resourceId;
         }
     }
     parent::handleEditValidationSuccess($banner, $site);
 }
 protected function handleEditValidationSuccess($videoNotification, $site = '')
 {
     if ($videoNotification->Id == NULL) {
         $sendMail = true;
     } else {
         $sendMail = false;
     }
     $data = $this->input->post();
     if (isset($data) && is_array($data)) {
         foreach ($data as $key => $value) {
             $videoNotification->IdVideo = $value;
         }
     }
     $userData = $this->session->userdata(USER_AUTHENTIC_COOKIE);
     $videoNotification->IdAccount = $this->session->userdata(USERID_LOGIN);
     $videoNotification->Id = $videoNotification->save();
     if ($videoNotification->Id != -1) {
         if ($site != ADMIN) {
             redirect('/' . lcfirst(get_class($this)) . '/view/' . $videoNotification->Id);
         } else {
             //$this->prepareDataForAdminListView();
             //$this->loadViewForAdminEditSuccessfully($videoNotification);
             if ($sendMail) {
                 $this->SendMail($videoNotification->IdVideo, $videoNotification->IdAccount);
             }
         }
     }
     //}
     parent::handleEditValidationSuccess($videoNotification, $site);
 }
Example #3
0
 protected function handleEditValidationSuccess($object, $site = '')
 {
     if ($object->Id == NULL) {
         $uplPath = $this->config->item('resource_folder') . '/logo';
         $uplConfig['upload_path'] = $uplPath;
         $uplConfig['allowed_types'] = '*';
         $this->load->library('upload', $uplConfig);
         if ($this->upload->do_upload('imgLink')) {
             $data = $this->upload->data();
             $resource = new Resource_model();
             $resource->Path = $uplPath . '/' . $data['file_name'];
             $resourceId = $resource->save();
         } else {
             if (isset($object->IdLogo)) {
                 $resourceId = $object->IdLogo;
                 // in Updating situation
             } else {
                 $this->addDataForView('err', $this->upload->display_errors('<div>', '</div>'));
                 $this->template->load($this->template_admin, $this->getEditViewName(), $this->getDataForView());
                 return;
             }
         }
         if (isset($resourceId)) {
             $object->IdLogo = $resourceId;
         }
     }
     parent::handleEditValidationSuccess($object, $site);
 }
Example #4
0
 protected function handleEditValidationSuccess($videoSurvey, $site = '')
 {
     if ($videoSurvey->Id == NULL) {
         $uplPath = $this->config->item('resource_folder') . '/videoSurvey';
         $uplConfig['upload_path'] = $uplPath;
         $uplConfig['allowed_types'] = '*';
         $this->load->library('upload', $uplConfig);
         if ($this->upload->do_upload('uplSurvey')) {
             $data = $this->upload->data();
             $resource = new Resource_model();
             $resource->Path = $uplPath . '/' . $data['file_name'];
             $videoSurvey->FileName = $data['file_name'];
             $resourceId = $resource->save();
         } else {
             $this->addDataForView('err', $this->upload->display_errors('<div>', '</div>'));
             $this->template->load($this->template_admin, $this->getEditViewName(), $this->getDataForView());
             return;
         }
         if (isset($resourceId)) {
             $videoSurvey->IdResource = $resourceId;
         }
     }
     $videoSurvey->Approved = $this->input->post('check1');
     $videoSurvey->Id = $videoSurvey->save();
     if ($videoSurvey->Id != -1) {
         if ($site != ADMIN) {
             redirect('/' . lcfirst(get_class($this)) . '/view/' . $videoSurvey->Id);
         }
     }
     parent::handleEditValidationSuccess($videoSurvey, $site);
 }
Example #5
0
 protected function handleEditValidationSuccess($video, $site = '')
 {
     if ($video->Id == NULL) {
         $uplPath = $this->config->item('resource_folder') . '/video';
         $uplConfig['upload_path'] = $uplPath;
         $uplConfig['allowed_types'] = '*';
         $this->load->library('upload', $uplConfig);
         if ($this->upload->do_upload('uplVideo')) {
             $data = $this->upload->data();
             $outputFile = $this->convertVideo($uplPath . '/' . $data['file_name']);
             $thumbnailPath = $this->config->item('resource_folder') . '/video_thumbnail';
             $thumbnailFile = create_thumbnail($outputFile, $this->config->item('thumbnail_video_width'), $this->config->item('thumbnail_video_height'), $thumbnailPath);
             if ($outputFile && $thumbnailFile) {
                 $resourceVideo = new Resource_model();
                 $resourceVideo->Path = $outputFile;
                 $resourceVideoId = $resourceVideo->save();
                 $resourceThumbnail = new Resource_model();
                 $resourceThumbnail->Path = $thumbnailFile;
                 $resourceThumbnailId = $resourceThumbnail->save();
             }
         } else {
             $this->addDataForView('err', $this->upload->display_errors('<div>', '</div>'));
             $this->template->load($this->template_admin, $this->getEditViewName(), $this->getDataForView());
             return;
         }
         if (isset($resourceVideoId)) {
             $video->IdResource = $resourceVideoId;
             $video->IdThumbnail = $resourceThumbnailId;
             $video->OwnerBy = $this->Account_model->getLoggedInUserId();
         }
     }
     parent::handleEditValidationSuccess($video, $site);
 }
Example #6
0
 protected function handleEditValidationSuccess($message, $site = '')
 {
     $message->State = 1;
     $message->OwnerBy = $this->Account_model->getLoggedInUserId();
     $message->Id = $message->save();
     $result = "";
     if (isset($message->Id)) {
         $ReceiverAdd = $this->input->post('Receiver');
         $addresses = explode(";", $ReceiverAdd);
         // wordswarp($ReceiverAdd,";");
         foreach ($addresses as $address) {
             if (isset($address)) {
                 $account_message = new Account_message_model();
                 $Account = $this->Account_model->getByEmail($address);
                 if ($Account != NULL) {
                     $account_message->IdAccount = $Account->Id;
                     $account_message->IdMessage = $message->Id;
                     $account_message->IsRead = 0;
                     //to avoid duplicating entry on "account_message" table
                     $query = "SELECT * FROM account_message where IdAccount=? AND IdMessage=?";
                     $account_message_temp = $this->db->query($query, array($account_message->IdAccount, $account_message->IdMessage));
                     if (!isset($account_message_temp) || $account_message_temp->num_rows() == 0) {
                         $result = $account_message->save();
                     }
                 }
                 //$message->Receiver = $message->Receiver . $Account->Email;
             }
         }
         if ($result != -1) {
             if ($site != ADMIN) {
                 redirect('/' . lcfirst(get_class($this)) . '/view/' . $message->Id);
             } else {
                 //parent::handleEditValidationSuccess($message, $site);
             }
         }
     }
     parent::handleEditValidationSuccess($message, $site);
 }