Removing old code, removing require_once + format code

1.10.x
Julio Montoya 11 years ago
parent 400a11401a
commit 0ace54a37b
  1. 56
      main/inc/lib/career.lib.php
  2. 11
      main/inc/lib/event_email_template.class.php

@ -1,30 +1,24 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/**
* This class provides methods for the notebook management.
* Include/require it in your code to use its features.
* @package chamilo.library
*/
/**
* Code
*/
require_once 'promotion.lib.php';
require_once 'fckeditor/fckeditor.php';
define ('CAREER_STATUS_ACTIVE', 1);
define ('CAREER_STATUS_INACTIVE',0);
/**
* @package chamilo.library
*/
/** /**
* Class Career * Class Career
*/ */
class Career extends Model class Career extends Model
{ {
public $table; public $table;
public $columns = array('id', 'name','description','status','created_at','updated_at'); public $columns = array(
'id',
'name',
'description',
'status',
'created_at',
'updated_at'
);
/**
* Constructor
*/
public function __construct() public function __construct()
{ {
$this->table = Database::get_main_table(TABLE_CAREER); $this->table = Database::get_main_table(TABLE_CAREER);
@ -32,6 +26,7 @@ class Career extends Model
/** /**
* Get the count of elements * Get the count of elements
* @return int
*/ */
public function get_count() public function get_count()
{ {
@ -50,8 +45,8 @@ class Career extends Model
/** /**
* Update all promotion status by career * Update all promotion status by career
* @param int career id * @param int $career_id
* @param int status (1 or 0) * @param int $status (1 or 0)
*/ */
public function update_all_promotion_status_by_career_id($career_id, $status) public function update_all_promotion_status_by_career_id($career_id, $status)
{ {
@ -96,13 +91,6 @@ class Career extends Model
*/ */
public function return_form($url, $action) public function return_form($url, $action)
{ {
$oFCKeditor = new FCKeditor('description');
$oFCKeditor->ToolbarSet = 'careers';
$oFCKeditor->Width = '100%';
$oFCKeditor->Height = '200';
$oFCKeditor->Value = '';
$oFCKeditor->CreateHtml();
$form = new FormValidator('career', 'post', $url); $form = new FormValidator('career', 'post', $url);
// Setting the form elements // Setting the form elements
$header = get_lang('Add'); $header = get_lang('Add');
@ -115,14 +103,23 @@ class Career extends Model
$form->addElement('hidden', 'id', $id); $form->addElement('hidden', 'id', $id);
$form->addElement('text', 'name', get_lang('Name'), array('size' => '70')); $form->addElement('text', 'name', get_lang('Name'), array('size' => '70'));
$form->add_html_editor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'careers','Width' => '100%', 'Height' => '250')); $form->add_html_editor(
'description',
get_lang('Description'),
false,
false,
array(
'ToolbarSet' => 'careers',
'Width' => '100%',
'Height' => '250'
)
);
$status_list = $this->get_status_list(); $status_list = $this->get_status_list();
$form->addElement('select', 'status', get_lang('Status'), $status_list); $form->addElement('select', 'status', get_lang('Status'), $status_list);
if ($action == 'edit') { if ($action == 'edit') {
$form->addElement('text', 'created_at', get_lang('CreatedAt')); $form->addElement('text', 'created_at', get_lang('CreatedAt'));
$form->freeze('created_at'); $form->freeze('created_at');
} }
if ($action == 'edit') { if ($action == 'edit') {
$form->addElement('style_submit_button', 'submit', get_lang('Modify'), 'class="save"'); $form->addElement('style_submit_button', 'submit', get_lang('Modify'), 'class="save"');
} else { } else {
@ -142,6 +139,7 @@ class Career extends Model
// Setting the rules // Setting the rules
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
return $form; return $form;
} }
@ -184,6 +182,7 @@ class Career extends Model
} }
} }
} }
return $cid; return $cid;
} }
@ -216,6 +215,7 @@ class Career extends Model
if (!empty($id)) { if (!empty($id)) {
event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
} }
return $id; return $id;
} }

@ -55,15 +55,8 @@ class EventEmailTemplate extends Model {
* @param string action add, edit * @param string action add, edit
* @return obj form validator obj * @return obj form validator obj
*/ */
public function return_form($url, $action) { public function return_form($url, $action)
{
$oFCKeditor = new FCKeditor('description') ;
$oFCKeditor->ToolbarSet = 'careers';
$oFCKeditor->Width = '100%';
$oFCKeditor->Height = '200';
$oFCKeditor->Value = '';
$oFCKeditor->CreateHtml();
$form = new FormValidator('career', 'post', $url); $form = new FormValidator('career', 'post', $url);
// Setting the form elements // Setting the form elements
$header = get_lang('Add'); $header = get_lang('Add');

Loading…
Cancel
Save