$form_hidden = array(sha1("editcurriculumtype") => sha1(random_string("alnum", 5))); echo form_open("dashboard/curriculums/settings/types/" . ($curriculumtypeinfo ? $curriculumtypeinfo->getCurriculumtypeid() : 0) . "/edit", $form_attr, $form_hidden); ?> <div class="form-group <?php echo has_error("curriculumType") ? "has-error" : (has_success("curriculumType") ? "has-success" : ""); ?> "> <label for="curriculumTypeinput" class="col-sm-4 control-label">Curriculum type</label> <div class="col-sm-8"> <input name="curriculumType" type="text" id="curriculumTypeinput" class="form-control" value="<?php echo set_value("curriculumType", $curriculumtypeinfo ? $curriculumtypeinfo->curriculum_type : ""); ?> " /> <?php echo has_message("curriculumType") ? '<span class="help-block">' . get_message("curriculumType") . '</span>' : ""; ?> </div> </div> <div class="form-group"> <div class="col-sm-8 col-sm-offset-4"> <button name="saveUpdatecurriculumtype" type="submit" class="btn btn-primary"> Save </button> <a href="<?php echo site_url("dashboard/curriculums/settings/types"); ?> " id="cancelUpdatecurriculumtype" class="btn btn-danger rounded-corners-4px"> Cancel </a> <div> </div> </form> </div>
echo has_message("majorCode") ? '<span class="help-block">' . get_message("majorCode") . '</span>' : ""; ?> </div> </div> <div class="form-group <?php echo has_error("majorDescription") ? "has-error" : (has_success("majorDescription") ? "has-success" : ""); ?> "> <label for="majorDescriptioninput" class="col-sm-4 control-label">Major Description</label> <div class="col-sm-8"> <?php $majorDescriptioninput = array('name' => 'majorDescription', 'class' => "form-control", 'id' => 'majorDescriptioninput', 'value' => set_value("majorDescription", $majorinfo ? $majorinfo->major_description : ""), 'rows' => '3'); echo form_textarea($majorDescriptioninput); ?> <?php echo has_message("majorDescription") ? '<span class="help-block">' . get_message("majorDescription") . '</span>' : ""; ?> </div> </div> <div class="form-group"> <div class="col-sm-8 col-sm-offset-4"> <button name="saveNewmajor" type="submit" class="btn btn-primary"> Save </button> <a href="<?php echo site_url("dashboard/curriculums/settings/majors"); ?> " id="canceladdNewmajor" class="btn btn-danger"> Cancel </a> <div> </div> </form> </div> </div>
<?php } ?> </div> </div> </div> <div class="row"> <div class="col-lg-12"> <?php if (has_message()) { ?> <div class="alert alert-<?php echo type_message() == 1 ? "success" : "danger"; ?> "> <i class="fa <?php echo type_message() == 1 ? "fa-check-circle" : "fa-times-circle"; ?> fa-fw fa-lg"></i> <?php echo display_message(); ?> </div> <?php }
" type="text" class="form-control" name="curriculumYear" id="inputCurriculumyear" data-min="0" data-max="<?php echo $yend; ?> " data-step="1" data-rule="Year" /> <span class="input-group-addon add-on"> <a href="#" class="spin-up" data-spin="up"> <span class="glyphicon glyphicon-triangle-top icon-sort-up"></span> </a> <a href="#" class="spin-down" data-spin="down"> <span class="glyphicon glyphicon-triangle-bottom icon-sort-down"></span> </a> </span> </div> <?php if (has_message("curriculumYear")) { echo '<span class="help-block">' . get_message("curriculumYear") . '</span>'; } ?> </div> </div> </fieldset> </div> </div> <div class="form-group"> <div class="text-center col-md-2 col-md-offset-5"> <button id="saveCurriculumbtn" type="submit" class="btn btn-primary form-control ">Save</button> </div> <div class="text-center col-md-2"> <div id="resetCurriculumbtncontainer" class="<?php
</span> <?php $password = array('name' => 'passwordfield', 'value' => "", 'class' => 'text-center form-control', 'placeholder' => 'Password'); echo form_password($password); ?> <span class=" input-group-btn form-field-clear-btn-group" id="password-field-clear-btn-group" > <button disabled data-target="password" id="password-field-clear-btn" class="form-field-clear-btn btn btn-default" type="button"> <i class="fa fa-times text-danger"></i> </button> </span> </div> <span id="passwordfield-help-block" class="margin-bottom-0 padding-left-50 <?php echo has_message("passwordfield") ? "" : "sr-only"; ?> help-block"> <i class=" fa fa-exclamation-circle"></i> <span id="passwordfield-message"><?php echo has_message("passwordfield") ? get_error_message("passwordfield") : ""; ?> </span></span> </div> <hr class="margin-top-0 margin-left-15 margin-right-15"> <div class="row margin-top-10"> <div class="col-sm-5 col-sm-offset-1"> <div class="form-group"> <button type="submit" name = "loginbtn" id="loginformsubmitbtn" class = " btn btn-default btn-md form-control input-md"> <i class="fa fa-sign-in"></i> Sign in </button> </div> </div> <div class="col-sm-5"> <div class="form-group">
<input value="<?php echo has_value("cssubjectUnit") ? get_value("cssubjectUnit") : set_value("cssubjectUnit", 0); ?> " type="text" class="form-control" name="cssubjectUnit" id="subjectUnitinput" data-max="10" data-min="0" data-step="1" data-rule="quantity" /> <span class="input-group-addon add-on"> <a href="#" class="spin-up" data-spin="up"> <span class="glyphicon glyphicon-triangle-top icon-sort-up"></span> </a> <a href="#" class="spin-down" data-spin="down"> <span class="glyphicon glyphicon-triangle-bottom icon-sort-down"></span> </a> </span> </div> <span class="help-block"><?php echo has_message("cssubjectUnit") ? get_message("cssubjectUnit") : ""; ?> </span> </div> </div> <div class="form-group"> <div class="col-sm-3 col-sm-offset-4"> <button type="submit" class="btn btn-primary form-control"> Save </button> </div> <div class="col-sm-3"> <a href="<?php echo site_url("dashboard/curriculums/" . ($curriculuminfo ? $curriculuminfo->getCurriculumid() : 0) . "/subjects/add"); ?> " class="rounded-corners-4px btn btn-danger form-control"> Reset </a> </div> </div>
echo has_message("yearlevelAlias") ? '<span class="help-block">' . get_message("yearlevelAlias") . '</span>' : ""; ?> </div> </div> <div class="form-group <?php echo has_error("yearlevelDescription") ? "has-error" : (has_success("yearlevelDescription") ? "has-success" : ""); ?> "> <label for="yearlevelDescriptioninput" class="col-sm-4 control-label">Year level Description</label> <div class="col-sm-8"> <input name="yearlevelDescription" type="text" id="yearlevelDescriptioninput" class="form-control" value="<?php echo set_value("yearlevelDescription", $yearlevelinfo ? $yearlevelinfo->yearlevel_description : ""); ?> " /> <?php echo has_message("yearlevelDescription") ? '<span class="help-block">' . get_message("yearlevelDescription") . '</span>' : ""; ?> </div> </div> <div class="form-group"> <div class="col-sm-8 col-sm-offset-4"> <button name="saveUpdateyearlevel" type="submit" class="btn btn-primary"> Save </button> <a href="<?php echo site_url("dashboard/curriculums/settings/yearlevels"); ?> " id="cancelUpdateyearelevel" class="btn btn-danger"> Cancel </a> <div> </div> </form> </div> </div>
function get_alert_message($ind = false, $closable = true, $withicon = true) { $OBJ =& get_message_lib_obj(); if ($OBJ === FALSE) { return false; } $ret = false; $message = has_message($ind) ? get_message($ind) : false; $messagetype = has_message_type($ind) ? get_message_type($ind) : false; $messagetitle = has_message_title($ind) ? get_message_title($ind) : false; if ($message) { $messagetype = checkAlerttype($messagetype); $messagetitle = checkMessagetitle($messagetitle); $ret = makeAlertmessage($messagetitle, $messagetype, $message, $closable, $withicon); } return $ret; }
function insert_or_update($arr) { // dump($arr); if (!empty($arr["id"])) { $this->insertObject = $this->db->get_where('users', array("id" => $arr["id"]))->row(); } else { $this->insertObject = new stdClass(); } $this->insertObject->name = $arr["name"]; $this->insertObject->username = $arr["username"]; $this->insertObject->password = md5($arr["password"]); $this->insertObject->company_id = empty($arr["company_id"]) ? $this->user->company_id : $arr["company_id"]; if (!$this->verify_user($arr["username"], $arr["id"])) { if ($this->has_user_access($arr["id"])) { if (!empty($arr["id"])) { $this->db->update('users', $this->insertObject, array("id" => $arr["id"])); $this->object = $this->get_($arr["id"]); } else { $this->db->insert('users', $this->insertObject); $this->object = $this->get_($this->db->insert_id()); } } else { set_message("Operação cancelada", 2); // TODO deviamos salvar um log aqui pra saber que este usuário quis fazer coisinhas } } else { set_message("Este usuário já está em uso", 2); } if (!has_message()) { if (!empty($arr["id"])) { set_message("Usuário " . $this->insertObject->name . " alterado"); } else { set_message("Usuário " . $this->insertObject->name . " criado"); } } return $this; // $this->db->update('users', $this->insertObject,array("id"=>$arr["id"])); // $this->object = $this->get_($arr["id"]); // if(!empty($arr["id"])){ // // update // if($this->user_is_mine($arr["id"])){ // if(!$this->verify_user($arr["username"],$arr["id"])){ // if($this->company_is_mine($arr["company_id"])) { // $this->insertObject->name = $arr["name"]; // $this->insertObject->username = $arr["username"]; // $this->insertObject->password = md5($arr["password"]); // $this->insertObject->company_id = $arr["company_id"]; // $this->db->update('users', $this->insertObject,array("id"=>$arr["id"])); // $this->object = $this->get_($arr["id"]); // }else{ // set_message("Você não tem direito de cadastrar um usuário para esta empresa",2); // } // }else{ // set_message("Este usuário já está em uso",2); // } // }else{ // set_message("Você não pode editar um usuário que não pertence a sua organização.",2); // } // if(!has_message()){ // set_message($this->object->name . " Editado com sucesso"); // } // }else{ // // dump($arr); // // insert // if(!$this->verify_user($arr["username"],$arr["id"])){ // if($this->company_is_mine($arr["company_id"])) { // $this->insertObject->name = $arr["name"]; // $this->insertObject->username = $arr["username"]; // $this->insertObject->password = md5($arr["password"]); // $this->insertObject->company_id = $arr["company_id"]; // $this->db->insert('users', $this->insertObject); // $this->object = $this->get_($this->db->insert_id()); // }else{ // set_message("Você não tem direito de cadastrar um usuário para esta empresa",2); // } // }else{ // set_message("Usuário já existe",2); // } // if(!has_message()){ // set_message($this->object->name . " Cadastrado com sucesso"); // } // } // return $this; // if(!$this->user_model->verify_user($user_arr["username"])){ // if($this->data["logged_user"]->developer != 1 ){ // $user_arr["company_id"] = $this->data["logged_user"]->company_id; // } // $user_arr["password"] = md5($user_arr["password"]); // if(!empty($user_arr["id"])){ // $id = $user_arr["id"]; // unset($user_arr["id"]); // $this->db->update('users', $user_arr, array("id"=>$id)); // }else{ // unset($user_arr["id"]); // $this->company_model->db->insert('users', $user_arr); // $id = $this->company_model->db->insert_id(); // } // $this->permission_model->set_role($id,$user_arr['role_id']); // dump($user_arr); // set_message("Usuário adicionado"); // }else{ // set_message("Este usuário já está em uso!",2); // } }
/** * Returns true if there are any success messages * @return bool */ function has_success() { return has_message("success"); }
function display_message() { if (has_message()) { $message = $_SESSION["data_message"]["message"]; unset($_SESSION["data_message"]); return $message; } }