public function isSatisfiedBy(Reference $reference)
 {
     if ($reference->getIsCouple() == true) {
         return true;
     }
     return false;
 }
 public function isSatisfiedBy(Reference $reference)
 {
     if ($reference->getRentShare() <= 500) {
         return true;
     }
     return false;
 }
Exemplo n.º 3
0
 private function setList()
 {
     $name = 'Fortune 1000 (' . $this->year . ')';
     $list = Doctrine_Query::create()->from('LsList L')->where('L.name = ?', $name)->fetchOne();
     //if thlis year's fortune list doesn't already exist, create it
     if (!$list) {
         try {
             $this->db->beginTransaction();
             $list = new LsList();
             $list->name = $name;
             $list->description = "Fortune Magazine's list of the 1000 US companies with the largest published revenue figures.";
             $list->is_ranked = 1;
             $list->save();
             $this->list = $list;
             $ref = new Reference();
             $ref->object_model = 'LsList';
             $ref->object_id = $list->id;
             $ref->fields = 'name, description, is_ranked';
             $ref->source = 'http://money.cnn.com/magazines/fortune/fortune500/' . $this->year . '/full_list/';
             $ref->name = 'Fortune Magazine Online';
             $ref->save();
             if (!$this->testMode) {
                 $this->db->commit();
             }
         } catch (Exception $e) {
             $this->db->rollback();
             throw $e;
         }
     } else {
         $this->list = $list;
     }
 }
 public function isSatisfiedBy(Reference $reference)
 {
     if ($reference->getStatus() == 'complete') {
         return true;
     }
     return false;
 }
Exemplo n.º 5
0
 public static function searchCrossRefDOI($doi)
 {
     $doi = preg_replace('!\\s+!', ' ', $doi);
     $url = "http://api.crossref.org/works/" . $doi;
     $apiRequest = Yii::app()->curl->run($url);
     if ($apiRequest->hasErrors()) {
         throw new CHttpException(500, 'Gagal menghubungi server CrossRef');
     } else {
         $apiResponse = CJSON::decode($apiRequest->getData());
         if ($apiResponse === null) {
             throw new CHttpException(404, "Tidak ditemukan hasil dari CrossRef");
         }
         $refType = $apiResponse['message']['type'];
         $ref = new Reference();
         switch ($refType) {
             case 'journal-article':
                 return $ref->createJournal($apiResponse['message']);
             case 'proceedings-article':
                 return $ref->createProceeding($apiResponse['message']);
             case 'book-chapter':
                 return $ref->createBookChapter($apiResponse['message']);
             case 'reference-entry':
                 return $ref->createBookChapter($apiResponse['message']);
             default:
                 throw new CHttpException(404, "Tidak ditemukan hasil dari CrossRef");
         }
     }
 }
Exemplo n.º 6
0
 /**
  * Swap this reference with another
  * @param \twhiston\twLib\Reference\Reference $point
  * @return mixed|null
  */
 public function &swap(Reference &$point)
 {
     $tmp =& $this->point;
     $pr =& $point->getRef();
     $this->reset($pr);
     $point->reset($tmp);
     return $tmp;
 }
Exemplo n.º 7
0
 /**
  * @throws BuildException
  */
 public function main()
 {
     $reffed = $this->reference !== null ? $this->reference->getReferencedObject($this->getProject()) : null;
     if ($reffed !== null && $reffed instanceof BuildException) {
         throw $reffed;
     }
     parent::main();
 }
Exemplo n.º 8
0
 /**
  * Reference to a classpath to use when loading the files.
  *
  * @param Reference $r
  *
  * @throws BuildException
  */
 public function setClasspathRef(Reference $r)
 {
     if ($this->isReference()) {
         throw $this->tooManyAttributes();
     }
     $this->classpathId = $r->getRefId();
     $this->createClasspath()->setRefid($r);
 }
Exemplo n.º 9
0
	function testAddDeveloperIdOnFirstWrite() {
		$reference = new Reference();
		$reference->write();
		$this->assertEquals(
			$reference->DeveloperID,
			Member::currentUserID(),
			'Developer ID is automatically set on first write'
		);
	}
Exemplo n.º 10
0
 function del()
 {
     $model = new Reference();
     $model->del();
     if ($_GET['parent'] != 0) {
         $this->redirect('/reference/' . $_GET['parent'] . '/');
     } else {
         $this->redirect('/reference/');
     }
 }
Exemplo n.º 11
0
 public function testFromTemplate()
 {
     $ref = Reference::fromTemplate('fake::mockup/index.html.twig');
     $this->assertEquals('fake::mockup/index.html.twig', $ref->getTemplateReference());
     $this->assertEquals('index.html', $ref->getShortReference());
     $this->assertEquals(0, $ref->getDepthLevel());
 }
Exemplo n.º 12
0
 /**
  * Check to see whether any DataType we hold references to is
  * included in the Stack (which holds all DataType instances that
  * directly or indirectly reference this instance, including this
  * instance itself).
  *
  * If one is included, throw a BuildException created by circularReference
  *
  * This implementation is appropriate only for a DataType that
  * cannot hold other DataTypes as children.
  *
  * The general contract of this method is that it shouldn't do
  * anything if checked is true and set it to true on exit.
  *
  * @param         $stk
  * @param Project $p
  *
  * @return void
  *
  * @throws BuildException
  */
 public function dieOnCircularReference(&$stk, Project $p)
 {
     if ($this->checked || !$this->isReference()) {
         return;
     }
     $o = $this->ref->getReferencedObject($p);
     if ($o instanceof DataType) {
         // TESTME - make sure that in_array() works just as well here
         //
         // check if reference is in stack
         //$contains = false;
         //for ($i=0, $size=count($stk); $i < $size; $i++) {
         //    if ($stk[$i] === $o) {
         //        $contains = true;
         //        break;
         //    }
         //}
         if (in_array($o, $stk, true)) {
             // throw build exception
             throw $this->circularReference();
         } else {
             array_push($stk, $o);
             $o->dieOnCircularReference($stk, $p);
             array_pop($stk);
         }
     }
     $this->checked = true;
 }
Exemplo n.º 13
0
 /**
  * @return Reference
  */
 public function __construct(Tracker $tracker, $keyword)
 {
     $base_id = 0;
     $visibility = 'P';
     $is_used = 1;
     parent::__construct($base_id, $keyword, $GLOBALS['Language']->getText('project_reference', 'reference_art_desc_key') . ' - ' . $tracker->getName(), TRACKER_BASE_URL . '/?aid=$1&group_id=$group_id', $visibility, trackerPlugin::SERVICE_SHORTNAME, Tracker_Artifact::REFERENCE_NATURE, $is_used, $tracker->getGroupId());
 }
Exemplo n.º 14
0
 /**
  * @param string $label
  *
  * @return Reference|null
  */
 public function getReference($label)
 {
     $label = Reference::normalizeReference($label);
     if (isset($this->references[$label])) {
         return $this->references[$label];
     }
 }
Exemplo n.º 15
0
 public function get_file($params = [])
 {
     $link_style = isset($params['link_style']) ? $params['link_style'] : 0;
     $reference = Reference::read_file($params['file_name'], $link_style);
     SiteStructure::set_page_title($reference['title']);
     Render::html($reference['content'], [], 'text/html');
 }
 /**
  * @param Reference $r
  *
  * @throws BuildException
  */
 public function setRefid(Reference $r)
 {
     if (count($this->parameters) !== 0 || $this->className !== null) {
         throw $this->tooManyAttributes();
     }
     $o = $r->getReferencedObject($this->getProject());
     if ($o instanceof PhingFilterReader) {
         $this->setClassName($o->getClassName());
         $this->setClasspath($o->getClassPath());
         foreach ($o->getParams() as $p) {
             $this->addParam($p);
         }
     } else {
         $msg = $r->getRefId() . " doesn\\'t refer to a PhingFilterReader";
         throw new BuildException($msg);
     }
     parent::setRefid($r);
 }
Exemplo n.º 17
0
 public function jsonAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $db_params = OpenContext_OCConfig::get_db_config();
     $db = new Zend_Db_Adapter_Pdo_Mysql($db_params);
     $db->getConnection();
     $requestParams = $this->_request->getParams();
     $host = App_Config::getHost();
     $reference = new Reference();
     $reference->initialize($requestParams);
     if ($reference->get_refs()) {
         header('Content-Type: application/json; charset=utf8');
         //echo Zend_Json::encode($reference->placeTokens);
         echo Zend_Json::encode($reference->tmPlaces);
     } else {
         $this->view->requestURI = $this->_request->getRequestUri();
         return $this->render('404error');
     }
 }
Exemplo n.º 18
0
 /**
  * adds a reference track from an object to another if that reference does not already exist
  * expects objects or arrays in the form array(id, 'ModelName')
  */
 public static function addReference($mFromObject, $mToObject)
 {
     if ($mFromObject instanceof BaseObject && $mFromObject->isNew()) {
         self::$aUnsavedReferences[] = array($mFromObject, $mToObject);
         return;
     }
     self::prepareObjectArgument($mFromObject);
     self::prepareObjectArgument($mToObject);
     if (self::referenceExists($mFromObject, $mToObject)) {
         return;
     }
     $oReference = new Reference();
     $oReference->setFromId($mFromObject[0]);
     $oReference->setFromModelName($mFromObject[1]);
     $oReference->setToId($mToObject[0]);
     $oReference->setToModelName($mToObject[1]);
     try {
         $oReference->save();
     } catch (PropelException $ex) {
         if ($ex->getCause() instanceof NotPermittedException) {
             //Silently discard NotPermittedException because the FromObject won’t be saved either
         } else {
             throw $ex;
         }
     }
 }
 function do_create()
 {
     global $feedback;
     $request =& HTTPRequest::instance();
     // Sanity check
     if (!$request->get('group_id') || !$request->get('keyword') || !$request->get('link')) {
         exit_error($GLOBALS['Language']->getText('global', 'error'), $GLOBALS['Language']->getText('project_reference', 'missing_parameter'));
     }
     $force = $request->get('force');
     if (!user_is_super_user()) {
         $force = false;
     }
     $reference_manager =& ReferenceManager::instance();
     if ($request->get('service_short_name') == 100) {
         // none
         $service_short_name = "";
     } else {
         $service_short_name = $request->get('service_short_name');
     }
     $ref = new Reference(0, $request->get('keyword'), $request->get('description'), $request->get('link'), $request->get('scope'), $service_short_name, $request->get('nature'), $request->get('is_used'), $request->get('group_id'));
     if ($ref->getGroupId() == 100 && $ref->isSystemReference()) {
         // Add reference to ALL active projects!
         $result = $reference_manager->createSystemReference($ref, $force);
         if (!$result) {
             exit_error($GLOBALS['Language']->getText('global', 'error'), $GLOBALS['Language']->getText('project_reference', 'create_fail'));
         } else {
             $feedback .= " " . $GLOBALS['Language']->getText('project_reference', 'system_r_create_success');
         }
     } else {
         $result = $reference_manager->createReference($ref, $force);
         if (!$result) {
             exit_error($GLOBALS['Language']->getText('global', 'error'), $GLOBALS['Language']->getText('project_reference', 'create_fail'));
         } else {
             $feedback .= " " . $GLOBALS['Language']->getText('project_reference', 'r_create_success') . " ";
         }
     }
 }
Exemplo n.º 20
0
 /**
  * Performs the check for circular references and returns the referenced object.
  *
  * @param $requiredClass
  * @param $dataTypeName
  *
  * @throws BuildException
  *
  * @return mixed
  */
 public function getCheckedRef($requiredClass, $dataTypeName)
 {
     if (!$this->checked) {
         // should be in stack
         $stk = array();
         $stk[] = $this;
         $this->dieOnCircularReference($stk, $this->getProject());
     }
     $o = $this->ref->getReferencedObject($this->getProject());
     if (!$o instanceof $requiredClass) {
         throw new BuildException($this->ref->getRefId() . " doesn't denote a " . $dataTypeName);
     } else {
         return $o;
     }
 }
Exemplo n.º 21
0
 function getBranch($parent, $last = false)
 {
     $data = array();
     if (count(Reference::$treeArray[$parent]) > 0) {
         foreach (Reference::$treeArray[$parent] as $item) {
             $item['sub'] = Reference::getBranch($item['id'], $last);
             if ($last && count($item['sub']) == 0) {
                 $data[$item['id']] = $item;
             } else {
                 $data[$item['path']] = $item;
             }
         }
     }
     return $data;
 }
Exemplo n.º 22
0
 public function addReference($source, $excerpt = null, $fields = null, $name = null, $detail = null, $date = null, $check_existing = true)
 {
     $object = $this->getInvoker();
     if (!$object->exists()) {
         throw new Exception("Can't add Reference to new object");
     }
     //make sure provided fields all exist
     if ($fields) {
         $entityFields = array_diff($object->getAllFields(), array('id'));
         if ($diff = array_diff((array) $fields, $entityFields)) {
             throw new Exception('Unknown fields: ' . implode(', ', $diff));
         }
     }
     //look for existing ref
     $ref = null;
     if ($check_existing == true) {
         $ref = $this->getReference($source, $detail);
     }
     if (!$ref) {
         $ref = new Reference();
         $ref->object_model = get_class($object);
         $ref->object_id = $object->id;
         $ref->source = $source;
         $ref->source_detail = $detail;
         $ref->publication_date = $date;
     }
     if (!$ref->name) {
         $ref->name = $name;
     }
     //add fields
     $ref->addFields($fields);
     //save ref and excerpt, if provided
     $db = Doctrine_Manager::connection();
     try {
         $db->beginTransaction();
         if ($excerpt) {
             $ref->addExcerpt($excerpt);
         }
         $ref->save();
         $db->commit();
     } catch (Exception $e) {
         $db->rollback();
         throw $e;
     }
     return $ref;
 }
Exemplo n.º 23
0
 /**
  * @param $id
  */
 public function allUserData($id, $mode = 'show')
 {
     if (!($user = User::find($id))) {
         abort(404);
     }
     $name = $user->full_name;
     if (!($fullProfile = Profile::where('user_id', '=', $id)->first())) {
         $fullProfile = new Profile();
     }
     $cityLiving = $this->placeLiving($fullProfile->place_living_id);
     $cityFrom = $this->placeFrom($fullProfile->place_from_id);
     $languages_high = Language::where('profile_id', '=', $fullProfile->id)->where('level', '=', 'advanced')->get();
     $languages_med = Language::where('profile_id', '=', $fullProfile->id)->where('level', '=', 'intermediate')->get();
     $languages_low = Language::where('profile_id', '=', $fullProfile->id)->where('level', '=', 'basic')->get();
     //Avatar is optional
     if ($user->avatar) {
         $avatar = $user->avatar;
     }
     if ($mode == 'show' || $mode == 'references') {
         $references = Reference::where('profile_user_id', '=', $id)->with(['user'])->orderBy('updated_at', 'DES')->get();
         $age = $user->age;
         $owner = \Auth::id() == $id;
         $gender = $user->gender;
         $places = $user->placesWanted;
         $placesVisited = $user->placesVisited;
         $avg = Reference::where('profile_user_id', '=', $id)->avg('grade');
         $ref = false;
         $fav = boolval(Favorites::where('owner_id', \Auth::id())->where('user_id', $id)->first());
         if ($mode == 'references') {
             $ref = true;
         }
         return compact('fullProfile', 'references', 'name', 'avatar', 'ref', 'avg', 'cityFrom', 'cityLiving', 'age', 'gender', 'id', 'owner', 'fav', 'languages_high', 'languages_med', 'languages_low', 'places', 'placesVisited');
     } else {
         if ($mode == 'edit') {
             return compact('fullProfile', 'cityFrom', 'cityLiving', 'name', 'avatar', 'id', 'languages_high', 'languages_med', 'languages_low');
         } else {
             return abort(404);
         }
     }
 }
Exemplo n.º 24
0
 function _keywordAndNumArgsExists($keyword, $num_args, $group_id)
 {
     $reference_dao = $this->_getReferenceDao();
     $dar = $reference_dao->searchByKeywordAndGroupId($keyword, $group_id);
     $existing_refs = array();
     while ($row = $dar->getRow()) {
         if (Reference::computeNumParam($row['link']) == $num_args) {
             return $row['reference_id'];
         }
     }
     return false;
 }
Exemplo n.º 25
0
//Delete old entrys in the Ip directory
$dirhelper->deleteOldIPs($fstat_cache_dir . "ip", $fstat_new_user);
//get the user from cache, on success it is a old user is_new is false then
$user->getFromCache(__DIR__ . "/" . $fstat_cache_dir . "ip");
if ($user->is_new) {
    //Daten auswerten
    $current_folder = __DIR__ . "/" . $fstat_data_dir . "stat/" . gmdate("Y", $user->time) . "/" . gmdate("m", $user->time);
    if ($dirhelper->checkExists($fstat_data_dir . "stat") == false || $dirhelper->checkExists($fstat_data_dir . "stat/" . gmdate("Y", $user->time)) == false || $dirhelper->checkExists($current_folder, true) == false) {
        //quit the execution here
        return 0;
    }
    //User Agent Parser
    $parser = new UAS\Parser(__DIR__ . "/" . $fstat_cache_dir, $fstat_update_interval, false, $fstat_update_auto);
    $uaa = $parser->Parse($user->agent);
    //ReferParser
    $ref = new Reference(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "");
    $ref->parse();
    //Country Parser
    $country = new Country(__DIR__ . "/dbip-country-1.csv", __DIR__ . "/dbip-country-2.csv", __DIR__ . "/dbip-country-3.csv", __DIR__ . "/dbip-country-4.csv", __DIR__ . "/dbip-country-5.csv");
    $country->parse($user->ip);
    //Browser Typ ist bis jetzt nicht deklariert
    $user->type = $uaa['typ'];
    //Daten in XML schreiben:
    $tmp_filename = $current_folder . "/" . gmdate("d", $user->time) . ".xml";
    if (file_exists($tmp_filename)) {
        $xmldoc = new DOMDocument();
        $xmldoc->preserveWhiteSpace = false;
        $xmldoc->formatOutput = true;
        $xmldoc->load($tmp_filename);
        $root = $xmldoc->documentElement;
    } else {
Exemplo n.º 26
0
 /**
  * Reference to a classpath to use when loading the files.
  */
 public function setClasspathRef(Reference $r)
 {
     $this->classpathId = $r->getRefId();
     $this->createClasspath()->setRefid($r);
 }
Exemplo n.º 27
0
 /**
  * Create
  *
  * $ref may be nullRef, then auto increment is used.
  */
 protected function create(Reference $ref, $properties)
 {
     // filter out unknown keys
     $properties = array_intersect_key($properties, $this->properties);
     if (!$ref->isNullRef()) {
         $properties = array_merge($properties, array_combine($this->describeId(), (array) $ref->id));
     }
     // Set times
     if ($this->time_created_table_column) {
         $properties[$this->time_created_table_column] = new \Smalldb\Flupdo\FlupdoRawSql('CURRENT_TIMESTAMP');
     }
     if ($this->time_modified_table_column) {
         $properties[$this->time_modified_table_column] = new \Smalldb\Flupdo\FlupdoRawSql('CURRENT_TIMESTAMP');
     }
     if (empty($properties)) {
         throw new \InvalidArgumentException('No valid properties provided.');
     }
     // Set owner
     if ($this->user_id_table_column) {
         $properties[$this->user_id_table_column] = $this->backend->getAuth()->getUserId();
     }
     // Check permission of owning machine
     if ($this->owner_relation && $this->owner_create_transition) {
         $ref_ref = $this->resolveMachineReference($this->owner_relation, $properties);
         if (!$ref_ref->machine->isTransitionAllowed($ref_ref, $this->owner_create_transition)) {
             throw new \RuntimeException(sprintf('Permission denied to create machine %s because transition %s of %s is not allowed.', $this->machine_type, $this->owner_create_transition, $ref->machine_type));
         }
     }
     // Insert
     $data = $this->encodeProperties($properties);
     $q = $this->flupdo->insert()->into($this->flupdo->quoteIdent($this->table));
     foreach ($data as $k => $v) {
         $q->insert($this->flupdo->quoteIdent($k));
     }
     $q->values([$data]);
     $n = $q->debugDump()->exec();
     if (!$n) {
         // Insert failed
         return false;
     }
     // Return ID of inserted row
     if ($ref->isNullRef()) {
         $id_keys = $this->describeId();
         $id = array();
         foreach ($id_keys as $k) {
             if (isset($properties[$k])) {
                 $id[] = $properties[$k];
             } else {
                 // If part of ID is missing, it must be autoincremented
                 // column, otherwise the insert would have failed.
                 $id[] = $this->flupdo->lastInsertId();
             }
         }
     } else {
         $id = $ref->id;
     }
     if ($this->nested_sets_enabled) {
         $this->recalculateTree();
     }
     return $id;
 }
Exemplo n.º 28
0
 function setRefid(Reference $r)
 {
     if (count($this->filterReaders) !== 0) {
         throw $this->tooManyAttributes();
     }
     // change this to get the objects from the other reference
     $o = $r->getReferencedObject($this->getProject());
     if ($o instanceof FilterChain) {
         $this->filterReaders = $o->getFilterReaders();
     } else {
         throw new BuildException($r->getRefId() . " doesn't refer to a FilterChain");
     }
     parent::setRefid($r);
 }
Exemplo n.º 29
0
 function other_info($employee_id = '')
 {
     $data['page_name'] = '<b>Personal Data Sheet</b>';
     $data['section_name'] = '<b>Personal Information</b>';
     $data['focus_field'] = 'skill';
     $data['msg'] = '';
     $e = new Employee_m();
     $data['employee'] = $e->get_by_id($employee_id);
     if (Input::get('op')) {
         // OTHER INFORMATION=========================
         $skills = Input::get('skill');
         $recognition = Input::get('recognition');
         $membership_organization = Input::get('membership_organization');
         $o = new Other_info();
         $o->get_by_employee_id($employee_id);
         $o->delete_all();
         $i = 0;
         foreach ($skills as $skill) {
             $o = new Other_info();
             $o->employee_id = $employee_id;
             $o->special_skills = $skills[$i];
             $o->recognition = $recognition[$i];
             $o->membership_organization = $membership_organization[$i];
             $o->save();
             $i++;
         }
         // QUESTIONS=======================================
         $questions = Input::get('q');
         $answer = Input::get('q');
         $details = Input::get('details');
         $q = new Question();
         $q->get_by_employee_id($employee_id);
         // Delete Questions
         $q->delete_all();
         $i = 0;
         $count = 0;
         foreach ($questions as $question) {
             $count += 1;
             $q = new Question();
             $q->employee_id = $employee_id;
             $q->question_no = $count;
             $q->answer = $answer[$i];
             $q->details = $details[$i];
             $q->save();
             $i++;
         }
         // REFERENCE
         $names = Input::get('ref_name');
         $address = Input::get('ref_address');
         $no = Input::get('ref_tel');
         $r = new Reference();
         $r->get_by_employee_id($employee_id);
         $r->delete_all();
         $i = 0;
         foreach ($names as $name) {
             $r = new Reference();
             $r->employee_id = $employee_id;
             $r->name = $names[$i];
             $r->address = $address[$i];
             $r->tel_no = $no[$i];
             $r->ctc_no = Input::get('ctc_no');
             $r->issue_at = Input::get('issue_at');
             $r->issue_on = Input::get('issue_on');
             $r->save();
             $i++;
         }
         $data['msg'] = 'Other Information has been saved!';
     }
     // Other information============================================
     $o = new Other_info();
     $data['infos'] = $o->get_by_employee_id($employee_id);
     // Question ====================================================
     $q = new Question();
     $data['question_options'] = array('0' => 'No', '1' => 'Yes');
     $data['question1'] = $q->get_question($employee_id, 1);
     $data['question2'] = $q->get_question($employee_id, 2);
     $data['question3'] = $q->get_question($employee_id, 3);
     $data['question4'] = $q->get_question($employee_id, 4);
     $data['question5'] = $q->get_question($employee_id, 5);
     $data['question6'] = $q->get_question($employee_id, 6);
     $data['question7'] = $q->get_question($employee_id, 7);
     $data['question8'] = $q->get_question($employee_id, 8);
     $data['question9'] = $q->get_question($employee_id, 9);
     $data['question10'] = $q->get_question($employee_id, 10);
     // References=================================================
     $r = new Reference();
     $data['references'] = $r->get_by_employee_id($employee_id);
     $data['selected'] = $e->office_id;
     //Use for office listbox
     $data['options'] = $this->options->office_options();
     $data['employee_id'] = $employee_id;
     $data['main_content'] = 'other_info';
     return View::make('includes/template', $data);
 }
Exemplo n.º 30
-2
 function page4($employee_id)
 {
     $this->load->helper('settings');
     $this->load->library('fpdf');
     //define('FPDF_FONTPATH',$this->config->item('fonts_path'));
     $this->load->library('fpdi');
     //print_r($personal_info);
     // initiate FPDI
     $pdf = new FPDI('P', 'mm', 'Legal');
     // add a page
     $pdf->AddPage();
     // set the sourcefile
     $pdf->setSourceFile('dtr/template/pds/page4.pdf');
     // import page 1
     $tplIdx = $pdf->importPage(1);
     // use the imported page and place it at point 10,10 with a width of 100 mm
     $pdf->useTemplate($tplIdx, 1, 1, 210);
     // now write some text above the imported page
     $pdf->SetFont('Arial');
     $pdf->SetTextColor(0, 0, 0);
     $pdf->SetXY(8, 14);
     $q = new Question();
     $q->order_by('question_no');
     $questions = $q->get_by_employee_id($employee_id);
     foreach ($questions as $question) {
         if ($question->question_no == 1) {
             if ($question->answer == 1) {
                 $setx = 138.5;
             } else {
                 $setx = 164;
             }
             $pdf->SetX($setx);
             $pdf->Write(0, 'X');
         }
         if ($question->question_no == 2) {
             $pdf->Ln(21);
             if ($question->answer == 1) {
                 $setx = 138.5;
             } else {
                 $setx = 164;
             }
             $pdf->SetX($setx);
             $pdf->Write(0, 'X');
         }
         if ($question->question_no == 3) {
             $pdf->Ln(26);
             if ($question->answer == 1) {
                 $setx = 138.5;
             } else {
                 $setx = 164;
             }
             $pdf->SetX($setx);
             $pdf->Write(0, 'X');
         }
         if ($question->question_no == 4) {
             $pdf->Ln(21);
             if ($question->answer == 1) {
                 $setx = 138.5;
             } else {
                 $setx = 164;
             }
             $pdf->SetX($setx);
             $pdf->Write(0, 'X');
         }
         if ($question->question_no == 5) {
             $pdf->Ln(26);
             if ($question->answer == 1) {
                 $setx = 138.5;
             } else {
                 $setx = 164;
             }
             $pdf->SetX($setx);
             $pdf->Write(0, 'X');
         }
         if ($question->question_no == 6) {
             $pdf->Ln(26);
             if ($question->answer == 1) {
                 $setx = 138.5;
             } else {
                 $setx = 164;
             }
             $pdf->SetX($setx);
             $pdf->Write(0, 'X');
         }
         if ($question->question_no == 7) {
             $pdf->Ln(21);
             if ($question->answer == 1) {
                 $setx = 138.5;
             } else {
                 $setx = 164;
             }
             $pdf->SetX($setx);
             $pdf->Write(0, 'X');
         }
         if ($question->question_no == 8) {
             $pdf->Ln(35);
             if ($question->answer == 1) {
                 $setx = 138.5;
             } else {
                 $setx = 164;
             }
             $pdf->SetX($setx);
             $pdf->Write(0, 'X');
         }
         if ($question->question_no == 9) {
             $pdf->Ln(12);
             if ($question->answer == 1) {
                 $setx = 138.5;
             } else {
                 $setx = 164;
             }
             $pdf->SetX($setx);
             $pdf->Write(0, 'X');
         }
         if ($question->question_no == 10) {
             $pdf->Ln(13);
             if ($question->answer == 1) {
                 $setx = 138.5;
             } else {
                 $setx = 164;
             }
             $pdf->SetX($setx);
             $pdf->Write(0, 'X');
         }
     }
     $pdf->SetXY(8, 233);
     //$pdf->Write(0, 'X');
     $r = new Reference();
     $references = $r->get_by_employee_id($employee_id);
     foreach ($references as $reference) {
         $pdf->SetX(8);
         $pdf->Write(0, $reference->name);
         $pdf->SetX(72);
         $pdf->Write(0, $reference->address);
         $pdf->SetX(134);
         $pdf->Write(0, $reference->tel_no);
         $pdf->Ln(4);
     }
     // CTC NO
     $pdf->SetXY(15, 275);
     $pdf->Write(0, $reference->ctc_no);
     $pdf->Ln(13);
     $pdf->SetX(15);
     $pdf->Write(0, $reference->issue_at);
     $pdf->Ln(13);
     $pdf->SetX(15);
     $pdf->Write(0, $reference->issue_on);
     $pdf->SetX(90);
     $pdf->Write(0, date('F d, Y'));
     // Output
     $pdf->Output('dtr/template/pds/page4_' . $employee_id . '.pdf', 'F');
     //header("location:".base_url()."resources/pdfs/archives/page4_".$employee_id.'.pdf');
     $this->pds[] = 'dtr/template/pds/page4_' . $employee_id . '.pdf';
 }