Ejemplo n.º 1
0
 /**
  * query if editable for current user
  */
 static function getEditableById($id)
 {
     global $auth;
     if ($auth->cur_user->user_rights & RIGHT_COMPANY_EDIT) {
         return Employment::getById(intval($id));
     }
     return NULL;
 }
Ejemplo n.º 2
0
 public function deleteEmployment()
 {
     $employment_id = Input::get('employment_id');
     $employment = Employment::find($employment_id);
     if (!$employment->delete()) {
         return Response::json(array('errCode' => 1, 'message' => '删除失败!'));
     }
     return Response::json(array('errCode' => 0, 'message' => '删除成功!'));
 }
Ejemplo n.º 3
0
 public function run()
 {
     Employment::create(['title' => '招聘信息', 'content' => '在长春一东离合器股份有限公司,习近平用“两个坚持”强调国企对国民经济的重要性,即“坚持国企在']);
     Employment::create(['title' => '招聘信息', 'content' => '在长春一东离合器股份有限公司,习近平用“两个坚持”强调国企对国民经济的重要性,即“坚持国企在']);
     Employment::create(['title' => '招聘信息', 'content' => '在长春一东离合器股份有限公司,习近平用“两个坚持”强调国企对国民经济的重要性,即“坚持国企在']);
     Employment::create(['title' => '招聘信息', 'content' => '在长春一东离合器股份有限公司,习近平用“两个坚持”强调国企对国民经济的重要性,即“坚持国企在']);
     Employment::create(['title' => '招聘信息', 'content' => '在长春一东离合器股份有限公司,习近平用“两个坚持”强调国企对国民经济的重要性,即“坚持国企在']);
     Employment::create(['title' => '招聘信息', 'content' => '在长春一东离合器股份有限公司,习近平用“两个坚持”强调国企对国民经济的重要性,即“坚持国企在']);
     Employment::create(['title' => '招聘信息', 'content' => '在长春一东离合器股份有限公司,习近平用“两个坚持”强调国企对国民经济的重要性,即“坚持国企在']);
     Employment::create(['title' => '招聘信息', 'content' => '在长春一东离合器股份有限公司,习近平用“两个坚持”强调国企对国民经济的重要性,即“坚持国企在']);
     Employment::create(['title' => '招聘信息', 'content' => '在长春一东离合器股份有限公司,习近平用“两个坚持”强调国企对国民经济的重要性,即“坚持国企在']);
     Employment::create(['title' => '招聘信息', 'content' => '在长春一东离合器股份有限公司,习近平用“两个坚持”强调国企对国民经济的重要性,即“坚持国企在']);
     Employment::create(['title' => '招聘信息', 'content' => '在长春一东离合器股份有限公司,习近平用“两个坚持”强调国企对国民经济的重要性,即“坚持国企在']);
     Employment::create(['title' => '招聘信息', 'content' => '在长春一东离合器股份有限公司,习近平用“两个坚持”强调国企对国民经济的重要性,即“坚持国企在']);
     Employment::create(['title' => '招聘信息', 'content' => '在长春一东离合器股份有限公司,习近平用“两个坚持”强调国企对国民经济的重要性,即“坚持国企在']);
     Employment::create(['title' => '招聘信息', 'content' => '在长春一东离合器股份有限公司,习近平用“两个坚持”强调国企对国民经济的重要性,即“坚持国企在']);
     Employment::create(['title' => '招聘信息', 'content' => '在长春一东离合器股份有限公司,习近平用“两个坚持”强调国企对国民经济的重要性,即“坚持国企在']);
     Employment::create(['title' => '招聘信息', 'content' => '在长春一东离合器股份有限公司,习近平用“两个坚持”强调国企对国民经济的重要性,即“坚持国企在']);
     Employment::create(['title' => '招聘信息', 'content' => '在长春一东离合器股份有限公司,习近平用“两个坚持”强调国企对国民经济的重要性,即“坚持国企在']);
     Employment::create(['title' => '招聘信息', 'content' => '在长春一东离合器股份有限公司,习近平用“两个坚持”强调国企对国民经济的重要性,即“坚持国企在']);
     Employment::create(['title' => '招聘信息', 'content' => '在长春一东离合器股份有限公司,习近平用“两个坚持”强调国企对国民经济的重要性,即“坚持国企在']);
     Employment::create(['title' => '招聘信息', 'content' => '在长春一东离合器股份有限公司,习近平用“两个坚持”强调国企对国民经济的重要性,即“坚持国企在']);
 }
Ejemplo n.º 4
0
/**
* Unlink a person from a company @ingroup pages
*/
function personCompaniesDelete()
{
    global $PH;
    $id = getOnePassedId('person', 'people_*');
    $person = Person::getEditableById($id);
    if (!$person) {
        $PH->abortWarning("Could not get object...");
    }
    $company_ids = getPassedIds('company', 'companies_*');
    if (!$company_ids) {
        $PH->abortWarning(__("No companies selected..."));
    }
    $employments = $person->getEmployments();
    $counter = 0;
    $errors = 0;
    foreach ($company_ids as $cid) {
        if (!($company = Company::getEditableById($cid))) {
            $PH->abortWarning("Could not access company by id");
        }
        $assigned_to = false;
        foreach ($employments as $e) {
            if ($e->company == $company->id) {
                $assigned_to = true;
                $e_id = $e->id;
                if ($assigned_to) {
                    $e_remove = Employment::getEditableById($e_id);
                    if (!$e_remove) {
                        $PH->abortWarning("Could not access employment by id");
                    } else {
                        if ($e_remove->delete()) {
                            $counter++;
                        } else {
                            $errors++;
                        }
                    }
                } else {
                    $PH->abortWarning("Company isn't related to this person");
                }
            }
        }
    }
    if ($errors) {
        new FeedbackWarning(sprintf(__("Failed to remove %s companies"), $errors));
    } else {
        new FeedbackMessage(sprintf(__("Removed %s companies"), $counter));
    }
    if (!$PH->showFromPage()) {
        $PH->show('personView', array('person' => $person->id));
    }
}
Ejemplo n.º 5
0
            
            <!--Employment Details-->
            
            <h4 align="center" class="alert alert-success">Employment Details</h4>
            <table class="table table-bordered table-hover">
            <thead>
            	<tr>
            		<th>S/N</th>
                    <th width="30%">Employer</th>
                    <th width="30%">Year of Employment</th>
                    <th width="40%">Employer's Address</th>
				</tr>
            </thead>
            <tbody>
			    <?php 
$employments = Employment::find_by_id($applicant_id);
if (empty($employments)) {
    echo '<tr>
								<td>1</td>
								<td>No Information Supplied</td>
								<td>No Information Supplied</td>
								<td>No Information Supplied</td>
							</tr>';
} else {
    if (!empty($employments->employment_detail_one)) {
        $emp = unserialize($employments->employment_detail_one);
        echo '<tr>
							  	<td>1</td>
							  	<td>' . $emp['employer'] . '</td>
							  	<td>' . $emp['year'] . '</td>
							  	<td>' . $emp['address'] . '</td>
Ejemplo n.º 6
0
            
            <!--Employment Details-->
            
            <h4 align="center" class="alert alert-success">Employment Details</h4>
            <table class="table table-bordered table-hover">
            <thead>
            	<tr>
            		<th>S/N</th>
                    <th width="30%">Employer</th>
                    <th width="30%">Year of Employment</th>
                    <th width="40%">Employer's Address</th>
				</tr>
            </thead>
            <tbody>
			    <?php 
$employments = Employment::find_by_id($session->applicant_id);
if (empty($employments)) {
    echo '<tr>
								<td>1</td>
								<td>No Information Supplied</td>
								<td>No Information Supplied</td>
								<td>No Information Supplied</td>
							</tr>';
} else {
    if (!empty($employments->employment_detail_one)) {
        $emp = unserialize($employments->employment_detail_one);
        echo '<tr>
							  	<td>1</td>
							  	<td>' . $emp['employer'] . '</td>
							  	<td>' . $emp['year'] . '</td>
							  	<td>' . $emp['address'] . '</td>
<?php

require_once '../inc/initialize.php';
$employment = new Employment();
/*loop for number of employment rows*/
for ($i = 1; $i < $_POST['num_of_emp_rows']; $i++) {
    $emp_key = 'employer_' . $i;
    $emp_year_key = 'employment_year_' . $i;
    $emp_addr_key = 'employer_address_' . $i;
    /*temporary array for employment details*/
    if ($_POST[$emp_key] == '') {
        continue;
    }
    $temp_arr = array('employer' => $_POST[$emp_key], 'year' => $_POST[$emp_year_key], 'address' => $_POST[$emp_addr_key]);
    /*Serialize for each column in the employment table*/
    switch ($i) {
        case 1:
            $employment->employment_detail_one = serialize($temp_arr);
            break;
        case 2:
            $employment->employment_detail_two = serialize($temp_arr);
            break;
        case 3:
            $employment->employment_detail_three = serialize($temp_arr);
            break;
        case 4:
            $employment->employment_detail_four = serialize($temp_arr);
            break;
        default:
            // Please remeber to set i
            break;
Ejemplo n.º 8
0
<?php

$db_emp = new MySQLDatabase();
$session = new Session();
$sql_emp = "SELECT * FROM employment WHERE applicant_id=" . $session->applicant_id;
$result_emp = Employment::find_by_sql($sql_emp);
//print_r($result_emp);
?>
<form action="" method="POST" class="employment_details" >

	<!-- Beginning of Employment Detais -->
	<table class="table table-hover">
	  <caption><h3>Employer Details</h3></caption>
	  <thead>
		<tr>
		   <th>S/N</th>
		  <th>Employer Name</th>
		  <th>Year of Employment</th>
		 <th>
		 	<div class="control-group"> 
				<div class="controls">
		 			Employer Address
		 		</div>
		 	</div>
		 </th>
		</tr>
	  </thead>
	  <tbody id="details_of_employment">
	  		<?php 
if (empty($result_emp)) {
    ?>
/**
* Submit data of a newly registered person @ingroup pages
*/
function personRegisterSubmit()
{
    global $PH;
    global $auth;
    ### cancel ? ###
    if (get('form_do_cancel')) {
        if (!$PH->showFromPage()) {
            $PH->show('home', array());
        }
        exit;
    }
    if (!validateFormCrc()) {
        $PH->abortWarning(__('Invalid checksum for hidden form elements'));
    }
    $person = new Person(array('id' => 0));
    $person->user_rights = RIGHT_PERSON_EDIT_SELF;
    ### person category ###
    $pcategory = get('pcategory');
    if ($pcategory != NULL) {
        if ($pcategory == -1) {
            $person->category = PCATEGORY_STAFF;
        } else {
            if ($pcategory == -2) {
                $person->category = PCATEGORY_CONTACT;
            } else {
                $person->category = $pcategory;
            }
        }
    }
    $flag_ok = true;
    # update valid?
    # retrieve all possible values from post-data
    # NOTE:
    # - this could be an security-issue.
    # - TODO: as some kind of form-edit-behaviour to field-definition
    foreach ($person->fields as $f) {
        $name = $f->name;
        $f->parseForm($person);
    }
    $person->can_login = 1;
    $period = get('person_notification_period');
    ### turn off ###
    if ($period === 0 || $period === "0") {
        $person->settings &= USER_SETTING_NOTIFICATIONS ^ RIGHT_ALL;
        $person->notification_period = 0;
    } else {
        $person->settings |= USER_SETTING_NOTIFICATIONS;
        $person->notification_period = $period;
        if ($person->can_login && !$person->personal_email && !$person->office_email) {
            $flag_ok = false;
            $person->fields['office_email']->required = true;
            $person->fields['personal_email']->required = true;
            new FeedbackWarning(__("Sending notifactions requires an email-address."));
        }
    }
    if (get('person_html_mail')) {
        $person->settings |= USER_SETTING_HTML_MAIL;
    } else {
        $person->settings &= USER_SETTING_HTML_MAIL ^ RIGHT_ALL;
    }
    $zone = get('person_time_zone');
    if ($zone != NULL && $person->time_zone != 1.0 * $zone) {
        $person->time_zone = 1.0 * $zone;
        if ($zone == TIME_OFFSET_AUTO) {
            new FeedbackMessage(__("Using auto detection of time zone requires this user to relogin."));
        } else {
            $person->time_offset = $zone * 60.0 * 60.0;
            if ($person->id == $auth->cur_user->id) {
                $auth->cur_user->time_offset = $zone * 60.0 * 60.0;
            }
        }
    }
    $theme = get('person_theme');
    if ($theme != NULL) {
        $person->theme = $theme;
        ### update immediately / without page-reload ####
        if ($person->id == $auth->cur_user->id) {
            $auth->cur_user->theme = $theme;
        }
    }
    $language = get('person_language');
    global $g_languages;
    if (isset($g_languages[$language])) {
        $person->language = $language;
        ### update immediately / without page-reload ####
        if ($person->id == $auth->cur_user->id) {
            $auth->cur_user->language = $language;
            setLang($language);
        }
    }
    if (!$person->name) {
        new FeedbackWarning(__("Login-accounts require a full name."));
        $person->fields['name']->required = true;
        $person->fields['name']->invalid = true;
        $flag_ok = false;
    }
    if (!$person->office_email) {
        new FeedbackWarning(__("Please enter an e-mail address."));
        $person->fields['office_email']->required = true;
        $person->fields['office_email']->invalid = true;
        $flag_ok = false;
    }
    $t_nickname = get('person_nickname');
    if (!$person->nickname) {
        new FeedbackWarning(__("Login-accounts require a unique nickname"));
        $person->fields['nickname']->required = true;
        $person->fields['nickname']->invalid = true;
        $flag_ok = false;
    }
    ### check if changed nickname is unique
    if ($person->can_login || $person->nickname != "") {
        /**
         * \todo actually this should be mb_strtolower, but this is not installed by default
         */
        if ($person->nickname != strtolower($person->nickname)) {
            new FeedbackMessage(__("Nickname has been converted to lowercase"));
            $person->nickname = strtolower($person->nickname);
        }
        if ($p2 = Person::getByNickname($t_nickname)) {
            # another person with this nick?
            if ($p2->id != $person->id) {
                new FeedbackWarning(__("Nickname has to be unique"));
                $person->fields['nickname']->required = true;
                $flag_ok = false;
            }
        }
    }
    ### password entered? ###
    $t_password1 = get('person_password1');
    $t_password2 = get('person_password2');
    $flag_password_ok = true;
    if (($t_password1 || $t_password2) && $t_password1 != "__dont_change__") {
        ### check if password match ###
        if ($t_password1 !== $t_password2) {
            new FeedbackWarning(__("Passwords do not match"));
            $person->fields['password']->required = true;
            $flag_ok = false;
            $flag_password_ok = false;
            $person->cookie_string = $auth->cur_user->calcCookieString();
        }
    }
    ### check if password is good enough ###
    $password_length = strlen($t_password1);
    $password_count_numbers = strlen(preg_replace('/[\\d]/', '', $t_password1));
    $password_count_special = strlen(preg_replace('/[\\w]/', '', $t_password1));
    $password_value = -7 + $password_length + $password_count_numbers * 2 + $password_count_special * 4;
    if ($password_value < confGet('CHECK_PASSWORD_LEVEL')) {
        new FeedbackWarning(__("Password is too weak (please add numbers, special chars or length)"));
        $flag_ok = false;
        $flag_password_ok = false;
    }
    if ($flag_password_ok) {
        $person->password = md5($t_password1);
    }
    if (!validateFormCaptcha()) {
        new FeedbackWarning(__("Please copy the text from the image."));
        $flag_ok = false;
    }
    ### repeat form if invalid data ###
    if (!$flag_ok) {
        $PH->show('personRegister', NULL, $person);
        exit;
    }
    /**
     * store indentifier-string for login from notification & reminder - mails
     */
    $person->identifier = $person->calcIdentifierString();
    ### insert new object ###
    if ($person->settings & USER_SETTING_NOTIFICATIONS && $person->can_login) {
        $person->settings |= USER_SETTING_SEND_ACTIVATION;
        new FeedbackHint(sprintf(__("A notification / activation  will be mailed to <b>%s</b> when you log out."), $person->name) . " " . sprintf(__("Read more about %s."), $PH->getWikiLink('notifications')));
    }
    $person->notification_last = getGMTString(time() - $person->notification_period * 60 * 60 * 24 - 1);
    $person->cookie_string = $person->calcCookieString();
    if ($person->insert()) {
        new FeedbackHint(__("Thank you for registration! After your request has been approved by a moderator, you will can an email."));
        ### link to a company ###
        if ($c_id = get('company')) {
            require_once confGet('DIR_STREBER') . 'db/class_company.inc.php';
            if ($c = Company::getVisibleById($c_id)) {
                require_once confGet('DIR_STREBER') . 'db/class_employment.inc.php';
                $e = new Employment(array('id' => 0, 'person' => $person->id, 'company' => $c->id));
                $e->insert();
            }
        }
        ## assigne to project ##
        require_once confGet('DIR_STREBER') . 'db/class_projectperson.inc.php';
        $prj_num = confGet('REGISTER_NEW_USERS_TO_PROJECT');
        global $g_user_profile_names;
        if (isset($prj_num)) {
            if ($prj_num != -1) {
                if ($p = Project::getVisibleById($prj_num)) {
                    $prj_person = new ProjectPerson(array('person' => $person->id, 'project' => $p->id, 'name' => $g_user_profile_names[$person->profile]));
                    $prj_person->insert();
                }
            }
        }
        new FeedbackMessage(sprintf(__('Person %s created'), $person->getLink()));
        ### automatically login ###
        $foo = array('login_name' => $person->nickname, 'login_password_md5' => $person->password);
        addRequestVars($foo);
        $PH->show('loginFormSubmit', array());
        exit;
    } else {
        new FeedbackError(__("Could not insert object"));
    }
    ### display fromPage ####
    if (!$PH->showFromPage()) {
        $PH->show('home', array());
    }
}
Ejemplo n.º 10
0
 public function employmentMore()
 {
     $employment_id = Input::get('employment_id');
     $employment = Employment::find($employment_id);
     return View::make('招贤纳士详细页面')->with(array('employment' => $employment, 'links' => $this->link()));
 }
Ejemplo n.º 11
0
 function render_tr(&$obj, $style = "")
 {
     global $PH;
     $str_url = "";
     $str_name = "";
     $str_addon = "";
     switch ($obj->type) {
         case ITEM_PROJECT:
             if ($project = Project::getVisibleById($obj->id)) {
                 $str_name = asHtml($project->name);
                 $str_url = $PH->getUrl('projView', array('prj' => $project->id));
             }
             break;
         case ITEM_TASK:
             if ($task = Task::getVisibleById($obj->id)) {
                 $str_name = asHtml($task->name);
                 $str_url = $PH->getUrl('taskView', array('tsk' => $task->id));
                 if ($project = Project::GetVisibleById($task->project)) {
                     $str_addon = "(" . $project->getLink(false) . ")";
                 }
             }
             break;
         case ITEM_COMMENT:
             if ($comment = Comment::getVisibleById($obj->id)) {
                 if ($comment->name == '') {
                     $str_name = "-";
                 } else {
                     $str_name = asHtml($comment->name);
                 }
                 $str_url = $PH->getUrl('taskView', array('tsk' => $comment->task));
                 $str_addon .= "(";
                 if ($task = Task::getVisibleById($comment->task)) {
                     if ($project = Project::getVisibleById($task->project)) {
                         $str_addon .= $project->getLink(false) . " > ";
                     }
                     $str_addon .= $task->getLink(false);
                     if ($comment->comment) {
                         if ($comm = Comment::getVisibleById($comment->comment)) {
                             $str_addon .= " > " . $comm->name;
                         }
                     }
                 }
                 $str_addon .= ")";
             }
             break;
         case ITEM_COMPANY:
             if ($c = Company::getVisibleById($obj->id)) {
                 $str_name = asHtml($c->name);
                 $str_url = $PH->getUrl('companyView', array('company' => $c->id));
             }
             break;
         case ITEM_PERSON:
             if ($person = Person::getVisibleById($obj->id)) {
                 $str_name = asHtml($person->name);
                 $str_url = $PH->getUrl('personView', array('person' => $person->id));
             }
             break;
         case ITEM_PROJECTPERSON:
             if ($pp = ProjectPerson::getVisibleById($obj->id)) {
                 if (!($person = new Person($pp->person))) {
                     $PH->abortWarning("ProjectPerson has invalid person-pointer!", ERROR_BUG);
                 }
                 $str_name = asHtml($person->name);
                 $str_url = $PH->getUrl('personView', array('person' => $person->id));
                 if ($project = Project::getVisibleById($pp->project)) {
                     $str_addon = "(" . $project->getLink(false) . ")";
                 }
             }
             break;
         case ITEM_EMPLOYMENT:
             if ($emp = Employment::getById($obj->id)) {
                 if ($person = Person::getVisibleById($emp->person)) {
                     $str_name = asHtml($person->name);
                     $str_url = $PH->getUrl('personView', array('person' => $person->id));
                 }
                 if ($company = Company::getVisibleById($emp->company)) {
                     $str_addon = "(" . $company->getLink(false) . ")";
                 }
             }
             break;
         case ITEM_EFFORT:
             if ($e = Effort::getVisibleById($obj->id)) {
                 $str_name = asHtml($e->name);
                 $str_url = $PH->getUrl('effortEdit', array('effort' => $e->id));
                 if ($task = Task::getVisibleById($e->task)) {
                     if ($project = Project::getVisibleById($task->project)) {
                         $str_addon .= "(" . $project->getLink(false);
                         $str_addon .= " > " . $task->getLink(false) . ")";
                     }
                 }
             }
             break;
         case ITEM_FILE:
             if ($f = File::getVisibleById($obj->id)) {
                 $str_name = asHtml($f->org_filename);
                 $str_url = $PH->getUrl('fileView', array('file' => $f->id));
                 $str_addon .= "(";
                 if ($p = Project::getVisibleById($f->project)) {
                     $str_addon .= $p->getLink(false);
                 }
                 if ($t = Task::getVisibleById($f->parent_item)) {
                     $str_addon .= " > " . $t->getLink(false);
                 }
                 $str_addon .= ")";
             }
             break;
         case ITEM_ISSUE:
             if ($i = Issue::getVisibleById($obj->id)) {
                 if ($t = Task::getVisibleById($i->task)) {
                     $str_name = asHtml($t->name);
                     $str_url = $PH->getUrl('taskView', array('tsk' => $t->id));
                     if ($p = Project::getVisibleById($t->project)) {
                         $str_addon .= "(" . $p->getLink(false) . ")";
                     }
                 }
             }
             break;
         case ITEM_TASKPERSON:
             if ($tp = TaskPerson::getVisibleById($obj->id)) {
                 if ($person = Person::getVisibleById($tp->person)) {
                     $str_name = asHtml($person->name);
                     $str_url = $PH->getUrl('personView', array('person' => $person->id));
                 }
                 if ($task = Task::getVisibleById($tp->task)) {
                     if ($project = Project::getVisibleById($task->project)) {
                         $str_addon .= "(" . $project->getLink(false);
                         $str_addon .= " > " . $task->getLink(false) . ")";
                     }
                 }
             }
             break;
         default:
             break;
     }
     print "<td><a href='{$str_url}'>{$str_name}</a><span class='sub who'> {$str_addon}</span></td>";
 }