public function afterAdd() { $this->my_language_model->remove_where(array("promotor_id" => $this->objectID)); if (isset($this->afterData["idiomas"])) { foreach ($this->afterData["idiomas"] as $index => $idioma_id) { $this->my_language_model->add(array("promotor_id" => $this->objectID, "lingua_id" => $idioma_id)); } } $this->address->process($this->getType(), $this->objectID); $this->contact->process($this->getType(), $this->objectID); $this->bank_account->process($this->getType(), $this->objectID); // load photo upload windows //echo $this->objectID; //header("Location: ".ROOT_PATH."ajax/casting/addPhotos/".$this->objectID); // keep popupform window opened SystemHelper::continuePopupWindow(); // set popupform title SystemHelper::setTitlePopupWindow("Adicionar fotos"); echo "<b>Enviar fotos para o Promotor " . $this->fields['nome_completo'] . "</b>"; echo "<div class='ls-box'>"; // display add photos form $this->showAddPhotosForm($this->objectID); echo '</div>'; }
public function createBackupFile($params = array()) { $zip = new ZipArchive(); $file_name_zip = "easycasting_backup_" . date('Y_m_d_H_i') . ".zip"; $this->generated_filename = $file_name_zip; $zip->open($this->backup_folder . $file_name_zip, ZipArchive::CREATE); if (isset($params['database']) && $params['database']) { $zip->addEmptyDir("banco_dados"); try { $this->load->dbutil(); $file_name_sql = "easycasting_backup_" . date('Y_m_d_H_i') . ".sql"; $backup_content = $this->dbutil->backup(array('format' => 'txt')); $zip->addFromString("banco_dados/" . $file_name_sql, $backup_content); } catch (Exception $e) { echo $e->getMessage(); SystemHelper::continuePopupWindow(); } } $files_casting = isset($params['casting_files']) && $params['casting_files'] ? true : false; $files_doc = isset($params['document_files']) && $params['document_files'] ? true : false; if ($files_casting || $files_doc) { $zip->addEmptyDir("arquivos"); } if ($files_casting) { $zip->addEmptyDir("arquivos/fotos_casting"); $scan_dir = array_diff(scandir("assets/pictures"), array("..", ".")); foreach ($scan_dir as $index => $file_casting) { try { $f_name = "assets/pictures/" . $file_casting; $file_opened = fopen($f_name, "rb"); ini_set('memory_limit', '-1'); $content_file = fread($file_opened, filesize($f_name)); fclose($file_opened); $zip->addFromString("arquivos/fotos_casting/" . $file_casting, $content_file); unset($content_file); } catch (Exception $ex) { echo $ex->getMessage(); SystemHelper::continuePopupWindow(); } } } if ($files_doc) { $zip->addEmptyDir("arquivos/documentos"); $scan_dir = array_diff(scandir("assets/files"), array("..", ".")); foreach ($scan_dir as $index => $file_doc) { try { $zip->addFromString("arquivos/documentos/" . $file_doc, file_get_contents("assets/files/" . $file_doc)); } catch (Exception $ex) { echo $ex->getMessage(); SystemHelper::continuePopupWindow(); } } } $zip->close(); return true; }