Exemple #1
0
 public function testExportInsideValidateMethod_ComposedClass()
 {
     $f = new Family();
     $f->setFather(new Person("Pa", 46));
     $f->setMother(new Person("Ma", 40));
     $out = $this->familyValidator->validate($f);
     $this->assertEquals("Pa-Ma", $out);
 }
Exemple #2
0
 public function actionCreate()
 {
     $model = new Family();
     if (isset($_POST['Family'])) {
         $model->attributes = $_POST['Family'];
         $model->validate($model) && $model->save() && $this->redirect(Yii::app()->createUrl('family'));
     }
     $this->render('create', array('model' => $model));
 }
Exemple #3
0
 public function setUp()
 {
     $this->person = new Person("fabs", 35);
     $this->localizedPerson = new LocalizedPerson("fabs", 35, "Rue De La Roquette");
     $this->noGetEntity = new NoGetters("laurent");
     $family = new Family();
     $family->setFather(new Person("Pa", 50));
     $family->setMother(new Person("Ma", 48));
     $this->family = $family;
 }
 function run()
 {
     $fp = fopen('php://output', 'w');
     header('Content-type: application/force-download');
     header("Content-Type: application/download");
     header('Content-type: text/csv');
     header('Content-Disposition: attachment; filename="jethro_' . date('Y-m-d_h:i') . '.csv"');
     $GLOBALS['system']->includeDBClass('family');
     $GLOBALS['system']->includeDBClass('person');
     switch (array_get($_REQUEST, 'merge_type')) {
         case 'family':
             $merge_data = Family::getFamilyDataByMemberIDs($_POST['personid']);
             $dummy = new Family();
             $dummy_family = NULL;
             break;
         case 'person':
         default:
             $merge_data = $GLOBALS['system']->getDBObjectData('person', array('id' => (array) $_POST['personid']));
             $dummy = new Person();
             $dummy_family = new Family();
             break;
     }
     $headerrow = array('ID');
     foreach (array_keys(reset($merge_data)) as $header) {
         if ($header == 'familyid') {
             continue;
         }
         $headerrow[] = strtoupper($dummy->getFieldLabel($header));
     }
     fputcsv($fp, $headerrow);
     foreach ($merge_data as $id => $row) {
         @$dummy->populate($id, $row);
         $outputrow = array($id);
         foreach ($row as $k => $v) {
             if ($k == 'history') {
                 continue;
             }
             if ($k == 'familyid') {
                 continue;
             }
             if ($dummy->hasField($k)) {
                 $outputrow[] = $dummy->getFormattedValue($k, $v);
                 // pass value to work around read-only fields
             } else {
                 if ($dummy_family && $dummy_family->hasField($k)) {
                     $outputrow[] = $dummy_family->getFormattedValue($k, $v);
                 } else {
                     $outputrow[] = $v;
                 }
             }
         }
         fputcsv($fp, $outputrow);
     }
     fclose($fp);
 }
 /**
  * This is construct base of the class.
  *
  * A public constructor; initializes the variable $instanceDataBase.
  *
  */
 public function __construct($instanceDataBase)
 {
     parent::__construct($instanceDataBase);
     Family::setDataOperationBusiness($instanceDataBase);
     Family::getBusiness();
     Family::getDescriptionBusiness();
 }
 public function Results()
 {
     $list = Family::get()->leftJoin('House', '"Family"."ID" = "House"."FamilyID"');
     $status = Convert::raw2sql($this->request->getVar('Status'));
     $holdsRationCard = Convert::raw2sql($this->request->getVar('HoldsRationCard'));
     $cardType = Convert::raw2sql($this->request->getVar('CardType'));
     $houseType = Convert::raw2sql($this->request->getVar('Type'));
     $parishID = Convert::raw2sql($this->request->getVar('ParishID'));
     if ($parishID) {
         $list = $list->filter(array('ParishID' => $parishID));
     }
     if ($status) {
         $list = $list->filter(array('House.Status' => $status));
     }
     if ($holdsRationCard != '') {
         $list = $list->filter(array('House.HoldsRationCard' => $holdsRationCard));
     }
     if ($holdsRationCard && $cardType) {
         $list = $list->filter(array('House.CardType' => $cardType));
     }
     if ($houseType) {
         $list = $list->filter(array('House.Type' => $houseType));
     }
     //$list = $list->leftJoin('Contact', "\"Contact\".\"FamilyID\" = \"Family\".\"ID\"");
     //Debug::show($list);
     return $list;
 }
Exemple #7
0
 function readPageXml($title)
 {
     $page = null;
     $xml = null;
     $titleString = $title->getText();
     if ($title->getNamespace() == NS_PERSON) {
         $page = new Person($titleString);
     } else {
         $page = new Family($titleString);
     }
     if ($page) {
         $page->loadPage();
         $xml = $page->getPageXml();
     }
     return $xml;
 }
 public function Results()
 {
     $list = Family::get();
     $blockNo = Convert::raw2sql($this->request->getVar('BlockNo'));
     $unitNo = Convert::raw2sql($this->request->getVar('UnitNo'));
     $parishID = Convert::raw2sql($this->request->getVar('ParishID'));
     $pincode = Convert::raw2sql($this->request->getVar('Pincode'));
     $isPanchayat = Convert::raw2sql($this->request->getVar('IsPanchayat'));
     $isMunicipality = Convert::raw2sql($this->request->getVar('IsMunicipality'));
     $isCorporation = Convert::raw2sql($this->request->getVar('IsCorporation'));
     if ($parishID) {
         $list = $list->filter(array('ParishID' => $parishID));
     }
     if ($blockNo) {
         $list = $list->filter(array('BlockNo' => $blockNo));
     }
     if ($unitNo) {
         $list = $list->filter(array('UnitNo' => $unitNo));
     }
     if ($pincode) {
         $list = $list->filter(array('Pincode' => $pincode));
     }
     if ($isPanchayat) {
         $list = $list->filter(array('IsPanchayat' => $isPanchayat));
     }
     if ($isMunicipality) {
         $list = $list->filter(array('IsMunicipality' => $isMunicipality));
     }
     if ($isCorporation) {
         $list = $list->filter(array('IsCorporation' => $isCorporation));
     }
     //$list = $list->leftJoin('Contact', "\"Contact\".\"FamilyID\" = \"Family\".\"ID\"");
     //Debug::show($list);
     return $list;
 }
Exemple #9
0
 function _getFields()
 {
     $memberFields = array('first_name', 'last_name', 'gender', 'age_bracket', 'congregationid', 'email', 'mobile_tel', 'work_tel', 'familyid', 'family_name', 'address_street', 'address_suburb', 'address_state', 'address_postcode', 'home_tel');
     $p = new Person();
     foreach ($p->_getFields() as $k => $v) {
         if (in_array($k, $memberFields)) {
             $res[$k] = $v;
         }
     }
     $f = new Family();
     foreach ($f->_getFields() as $k => $v) {
         if (in_array($k, $memberFields)) {
             $res[$k] = $v;
         }
     }
     return $res;
 }
Exemple #10
0
 public static function ConvertSEO()
 {
     $arrFamilies = Family::model()->findAll();
     foreach ($arrFamilies as $objFamily) {
         $objFamily->request_url = _xls_seo_url($objFamily->family);
         $objFamily->save();
     }
 }
Exemple #11
0
 private function loadModel($id)
 {
     $model = Family::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemple #12
0
 /**
  * 录入
  *
  */
 public function actionCreate()
 {
     parent::_acl();
     $model = new Family();
     $imageList = $this->_gets->getPost('imageList');
     $imageListSerialize = XUtils::imageListSerialize($imageList);
     if (isset($_POST['Family'])) {
         $acl = $this->_gets->getPost('acl');
         $model->attributes = $_POST['Family'];
         $model->actual_people = 0;
         $model->pic_other = $imageListSerialize['dataSerialize'];
         if ($model->save()) {
             AdminLogger::_create(array('catalog' => 'create', 'intro' => '录入内容,ID:' . $model->id));
             $this->redirect(array('index'));
         }
     }
     $this->render('family_create', array('model' => $model, 'imageList' => $imageListSerialize['data']));
 }
Exemple #13
0
 public static function findFamily($user)
 {
     $families = \Family::all(["user_id = ?" => $user->id], ["member_id", "relation"]);
     $fs = array();
     foreach ($families as $f) {
         $u = \User::first(["id = ?" => $f->member_id], ["name"]);
         $fs[(int) $f->member_id] = ArrayMethods::toObject(["name" => $u->name, "user_id" => $f->member_id, "relation" => $f->relation]);
     }
     return $fs;
 }
 private function getRecipients()
 {
     $recips = $archived = $blanks = array();
     if (!empty($_REQUEST['queryid'])) {
         $query = $GLOBALS['system']->getDBObject('person_query', (int) $_REQUEST['queryid']);
         $personids = $query->getResultPersonIDs();
         $recips = $GLOBALS['system']->getDBObjectData('person', array('(id' => $personids, '!mobile_tel' => '', '!status' => 'archived'), 'AND');
         $blanks = $GLOBALS['system']->getDBObjectData('person', array('(id' => $personids, 'mobile_tel' => '', '!status' => 'archived'), 'AND');
         $archived = $GLOBALS['system']->getDBObjectData('person', array('(id' => $personids, 'status' => 'archived'), 'AND');
     } else {
         if (!empty($_REQUEST['groupid'])) {
             $group = $GLOBALS['system']->getDBObject('person_group', (int) $_REQUEST['groupid']);
             $personids = array_keys($group->getMembers());
             $recips = $GLOBALS['system']->getDBObjectData('person', array('(id' => $personids, '!mobile_tel' => '', '!status' => 'archived'), 'AND');
             $blanks = $GLOBALS['system']->getDBObjectData('person', array('(id' => $personids, 'mobile_tel' => '', '!status' => 'archived'), 'AND');
             $archived = $GLOBALS['system']->getDBObjectData('person', array('(id' => $personids, 'status' => 'archived'), 'AND');
         } else {
             if (!empty($_REQUEST['roster_view'])) {
                 $view = $GLOBALS['system']->getDBObject('roster_view', (int) $_REQUEST['roster_view']);
                 $recips = $view->getAssignees($_REQUEST['start_date'], $_REQUEST['end_date']);
                 foreach ($recips as $i => $details) {
                     if ($details['status'] == 'archived') {
                         $archived[$i] = $details;
                         unset($recips[$i]);
                     } else {
                         if (empty($details['mobile_tel'])) {
                             $blanks[$i] = $details;
                             unset($recips[$i]);
                         }
                     }
                 }
             } else {
                 switch (array_get($_REQUEST, 'sms_type')) {
                     case 'family':
                         $GLOBALS['system']->includeDBClass('family');
                         $families = Family::getFamilyDataByMemberIDs($_POST['personid']);
                         $recips = $GLOBALS['system']->getDBObjectData('person', array('age_bracket' => '0', '(familyid' => array_keys($families), '!mobile_tel' => '', '!status' => 'archived'), 'AND');
                         $blanks = $GLOBALS['system']->getDBObjectData('person', array('age_bracket' => '0', '(familyid' => array_keys($families), 'mobile_tel' => '', '!status' => 'archived'), 'AND');
                         $archived = $GLOBALS['system']->getDBObjectData('person', array('age_bracket' => '0', '(familyid' => array_keys($families), 'status' => 'archived'), 'AND');
                         break;
                     case 'person':
                     default:
                         if (!empty($_POST['personid'])) {
                             $recips = $GLOBALS['system']->getDBObjectData('person', array('id' => $_POST['personid'], '!mobile_tel' => '', '!status' => 'archived'), 'AND');
                             $blanks = $GLOBALS['system']->getDBObjectData('person', array('id' => $_POST['personid'], 'mobile_tel' => '', '!status' => 'archived'), 'AND');
                             $archived = $GLOBALS['system']->getDBObjectData('person', array('id' => $_POST['personid'], 'status' => 'archived'), 'AND');
                             $GLOBALS['system']->includeDBClass('person');
                         }
                         break;
                 }
             }
         }
     }
     return array($recips, $blanks, $archived);
 }
Exemple #15
0
 function run()
 {
     // Ref: http://en.wikipedia.org/wiki/VCard
     header('Content-type: text/vcf');
     header('Content-Disposition: attachment; filename="contacts_' . date('Y-m-d_h:i') . '.vcf"');
     $GLOBALS['system']->includeDBClass('person');
     $GLOBALS['system']->includeDBClass('family');
     $merge_data = $GLOBALS['system']->getDBObjectData('person', array('id' => $_REQUEST['personid']));
     $dummy = new Person();
     $family = new Family();
     foreach ($merge_data as $id => $row) {
         $dummy->populate($id, $row);
         $family->setvalue('home_tel', $row['home_tel']);
         echo "BEGIN:VCARD\n";
         echo "VERSION:3.0\n";
         echo "N:" . $row['last_name'] . ";" . $row['first_name'] . ";;;\n";
         echo "FN:" . $row['first_name'] . " " . $row['last_name'] . "\n";
         echo "EMAIL;type=INTERNET;type=HOME:" . $row['email'] . "\n";
         echo "ADR;type=HOME:;;" . $row['address_street'] . ";" . $row['address_suburb'] . ";" . $row['address_state'] . ";" . $row['address_postcode'] . ";\n";
         echo "TEL;type=HOME:" . $family->getFormattedValue('home_tel') . "\n";
         echo "TEL;type=WORK:" . $dummy->getFormattedValue('work_tel') . "\n";
         echo "TEL;type=MOBILE:" . $dummy->getFormattedValue('mobile_tel') . "\n";
         echo "TEL;type=CELL:" . $dummy->getFormattedValue('mobile_tel') . "\n";
         if ($g = $dummy->getValue('Gender')) {
             echo "GENDER:" . strtoupper($g[0]) . "\n";
         }
         echo "CATEGORIES:" . $row['congregation'] . "\n";
         echo "ORG:" . $dummy->getFormattedValue('congregationid') . "\n";
         echo "NOTES:" . $dummy->getFormattedValue('congregationid') . "\n";
         echo "ROLE:" . $dummy->getFormattedValue('status') . "\n";
         echo "TITLE:" . $dummy->getFormattedValue('status') . "\n";
         echo "SOURCE:" . build_url(array('personid' => array($id))) . "\n";
         // where to get vcard from
         echo "URL:" . build_url(array('call' => NULL, 'view' => 'persons', 'personid' => $id)) . "\n";
         // definitive location for full details
         echo "UID:" . build_url(array('call' => NULL, 'view' => 'persons', 'personid' => $id)) . "\n";
         echo "END:VCARD\n\n";
     }
 }
 public function Results()
 {
     $list = Family::get()->leftJoin('Business', '"Family"."ID" = "Business"."FamilyID"');
     $agricultureType = Convert::raw2sql($this->request->getVar('Type'));
     $parishID = Convert::raw2sql($this->request->getVar('ParishID'));
     if ($parishID) {
         $list = $list->filter(array('ParishID' => $parishID));
     }
     if ($agricultureType) {
         $list = $list->filter(array('Business.Type' => $agricultureType));
     }
     //$list = $list->leftJoin('Contact', "\"Contact\".\"FamilyID\" = \"Family\".\"ID\"");
     //Debug::show($list);
     return $list;
 }
 public function Results()
 {
     $list = Family::get()->leftJoin('ShiftedFrom', '"Family"."ID" = "ShiftedFrom"."FamilyID"');
     $status = Convert::raw2sql($this->request->getVar('Status'));
     $area = Convert::raw2sql($this->request->getVar('Area'));
     $parishID = Convert::raw2sql($this->request->getVar('ParishID'));
     if ($parishID) {
         $list = $list->filter(array('ParishID' => $parishID));
     }
     if ($status != '') {
         $list = $list->filter(array('ShiftedFrom.Status' => $status));
     }
     //$list = $list->leftJoin('Contact', "\"Contact\".\"FamilyID\" = \"Family\".\"ID\"");
     //Debug::show($list);
     return $list;
 }
 public function Results()
 {
     $list = Family::get()->leftJoin('Land', '"Family"."ID" = "Land"."FamilyID"');
     $holdsLand = Convert::raw2sql($this->request->getVar('HoldsLand'));
     $area = Convert::raw2sql($this->request->getVar('Area'));
     $parishID = Convert::raw2sql($this->request->getVar('ParishID'));
     if ($parishID) {
         $list = $list->filter(array('ParishID' => $parishID));
     }
     if ($holdsLand != '') {
         $list = $list->filter(array('Land.HoldsLand' => $holdsLand));
     }
     if ($holdsLand && $area) {
         $list = $list->filter(array('Land.Area' => $area));
     }
     return $list;
 }
 /**
  * update the family information of the logged in user
  * @param $familyType
  * @param $familyStatus
  * @return array
  */
 public function updateUserFamily($familyType, $familyStatus)
 {
     $Object = new Family();
     $result = $Object->updateFamilyInformation($familyType, $familyStatus);
     return $result;
 }
echo $form->listBox($model, 'categories', CHtml::listData(Category::model()->findAllByAttributes(array('parent' => null), array('order' => 'label')), 'label', 'label'), array('multiple' => 'multiple', 'class' => 'tall wider', 'onChange' => 'js:FillListValues(this)', 'onMouseDown' => 'js:GetCurrentListValues(this)'));
?>
	        <div class="clearfix"></div><?php 
echo CHtml::link(Yii::t('admin', 'Clear All'), '#', array('class' => 'listboxReset', 'onclick' => 'js:jQuery($("#' . CHtml::activeId($model, 'categories') . '").find("option").prop("selected", false))'));
?>
	        <?php 
echo $form->error($model, 'categories');
?>
        </div>

        <div class="span3">
			<?php 
echo $form->labelEx($model, 'families');
?>
	        <?php 
echo $form->listBox($model, 'families', CHtml::listData(Family::model()->findAll(array('order' => 'family')), 'family', 'family'), array('multiple' => 'multiple', 'class' => 'tall wider', 'onChange' => 'js:FillListValues(this)', 'onMouseDown' => 'js:GetCurrentListValues(this)'));
?>
	        <div class="clearfix"></div><?php 
echo CHtml::link(Yii::t('admin', 'Clear All'), '#', array('class' => 'listboxReset', 'onclick' => 'js:jQuery($("#' . CHtml::activeId($model, 'families') . '").find("option").prop("selected", false))'));
?>
			<?php 
echo $form->error($model, 'families');
?>
        </div>
        <div class="span2">
			<?php 
echo $form->labelEx($model, 'classes');
?>
	        <?php 
echo $form->listBox($model, 'classes', CHtml::listData(Classes::model()->findAll(array('order' => 'class_name')), 'class_name', 'class_name'), array('multiple' => 'multiple', 'class' => 'tall', 'onChange' => 'js:FillListValues(this)', 'onMouseDown' => 'js:GetCurrentListValues(this)'));
?>
Exemple #21
0
            }
        }
        // Fetch all data, regardless of privacy
        $rows = get_SOUR_rows($WT_TREE, $term);
        // Filter for privacy
        foreach ($rows as $row) {
            $source = Source::getInstance($row->xref, $WT_TREE, $row->gedcom);
            if ($source->canShowName()) {
                $data[] = array('value' => $source->getXref(), 'label' => $source->getFullName());
            }
        }
        // Fetch all data, regardless of privacy
        $rows = get_FAM_rows($WT_TREE, $term);
        // Filter for privacy
        foreach ($rows as $row) {
            $family = Family::getInstance($row->xref, $WT_TREE, $row->gedcom);
            if ($family->canShowName()) {
                $marriage_year = $family->getMarriageYear();
                if ($marriage_year) {
                    $data[] = array('value' => $family->getXref(), 'label' => $family->getFullName() . ', <i>' . $marriage_year . '</i>');
                } else {
                    $data[] = array('value' => $family->getXref(), 'label' => $family->getFullName());
                }
            }
        }
        echo json_encode($data);
        return;
}
/**
 * Find family records from the database.
 *
Exemple #22
0
/**
 * Display family members with clickable links
 *
 * @param Family     $family
 * @param Individual $individual
 */
function print_navigator_family(Family $family, Individual $individual)
{
    foreach ($family->getSpouses() as $spouse) {
        ?>
		<tr class="fact_value">
			<td class="facts_value">
				<a href="edit_interface.php?action=addmedia_links&amp;noteid=newnote&amp;pid=<?php 
        echo $spouse->getXref();
        ?>
&amp;gedcom=<?php 
        echo $spouse->getTree()->getNameUrl();
        ?>
">
					<i class="headimg vmiddle icon-button_head"></i>
				</a>
			</td>
			<td class="facts_value" >
				<a href="#" onclick="opener.insertRowToTable('<?php 
        echo $spouse->getXref();
        ?>
', '<?php 
        echo Filter::escapeJs($spouse->getFullName());
        ?>
', '', '', '', '', '', '', '', ''); return false;">
					<?php 
        echo $spouse === $individual ? '<b>' : '';
        ?>
					<?php 
        echo $spouse->getFullName();
        ?>
 <?php 
        echo $spouse->getLifeSpan();
        ?>
					<?php 
        echo $spouse === $individual ? '</b>' : '';
        ?>
				</a>
			</td>
		<tr>
	<?php 
    }
    foreach ($family->getChildren() as $child) {
        ?>
		<tr>
			<td class="facts_value" >
				<a href="edit_interface.php?action=addmedia_links&amp;noteid=newnote&amp;pid=<?php 
        echo $child->getXref();
        ?>
&amp;gedcom=<?php 
        echo $child->getTree()->getNameUrl();
        ?>
">
					<i class="headimg vmiddle icon-button_head"></i>
				</a>
			</td>
			<td class="facts_value">
				<a href="#" onclick="opener.insertRowToTable('<?php 
        echo $child->getXref();
        ?>
', '<?php 
        echo Filter::escapeJs($child->getFullName());
        ?>
', '', '', '', '', '', '', '', ''); return false;">
					<?php 
        echo $child === $individual ? '<b>' : '';
        ?>
					<?php 
        echo $child->getFullName();
        ?>
 <?php 
        echo $child->getLifeSpan();
        ?>
				<?php 
        echo $child === $individual ? '</b>' : '';
        ?>
				</a>
			</td>
		</tr>
	<?php 
    }
}
Exemple #23
0
 /**
  * Propagate move, delete, or undelete to other articles if necessary
  *
  * @param String $newTitleString null in case of delete; same as this title string in case of undelete
  * @param String $text text of article
  * @param bool $textChanged set to true if we change the text
  * @return bool true if success
  */
 protected function propagateMoveDeleteUndelete($newTitleString, $newNs, &$text, &$textChanged)
 {
     global $wgESINHandler;
     $result = true;
     $newTitle = $newTitleString ? Title::newFromText($newTitleString, NS_FAMILY) : null;
     // if we're undeleting, add additional people from WLH, getting updated person data
     if ($this->titleString == $newTitleString) {
         $wlh = simplexml_load_string($this->getPageTextFromWLH(false));
         // get text for all people
         // TODO is propagateEditData called after Undelete? if so, then we could get updated person attributes there
         $personText = $this->getPersonData($wlh->husband, $this->xml->husband, 'husband') . $this->getPersonData($wlh->wife, $this->xml->wife, 'wife') . $this->getPersonData($wlh->child, $this->xml->child, 'child') . $wgESINHandler->getImageData($wlh->image, $this->xml->image);
         // update text: replace old family information with new
         $text = preg_replace("\$<(husband|wife|child|image) [^>]*>\n\$", '', $text);
         $text = preg_replace('$</family>$', StructuredData::protectRegexReplace($personText . '</family>'), $text, 1);
         $this->xml = StructuredData::getXml($this->tagName, $text);
         $textChanged = true;
     }
     // get data to propagate
     $propagatedData = Family::getPropagatedData($this->xml);
     foreach ($propagatedData['husbands'] as $p) {
         $personTitle = Title::newFromText((string) $p, NS_PERSON);
         PropagationManager::addPropagatedAction($this->title, 'delspouse', $personTitle);
         if ($newTitle) {
             PropagationManager::addPropagatedAction($newTitle, 'addspouse', $personTitle);
         }
         // don't need to check propagated action before calling updatePerson, because propagateMoveDeleteUndelete is never part of a loop
         $result = $result && $this->updatePerson($personTitle, 'husband', 'spouse_of_family', $newTitleString, $text, $textChanged);
     }
     foreach ($propagatedData['wives'] as $p) {
         $personTitle = Title::newFromText((string) $p, NS_PERSON);
         PropagationManager::addPropagatedAction($this->title, 'delspouse', $personTitle);
         if ($newTitle) {
             PropagationManager::addPropagatedAction($newTitle, 'addspouse', $personTitle);
         }
         // don't need to check propagated action before calling updatePerson, because propagateMoveDeleteUndelete is never part of a loop
         $result = $result && $this->updatePerson($personTitle, 'wife', 'spouse_of_family', $newTitleString, $text, $textChanged);
     }
     foreach ($propagatedData['children'] as $p) {
         $personTitle = Title::newFromText((string) $p, NS_PERSON);
         PropagationManager::addPropagatedAction($this->title, 'delchild', $personTitle);
         if ($newTitle) {
             PropagationManager::addPropagatedAction($newTitle, 'addchild', $personTitle);
         }
         // don't need to check propagated action before calling updatePerson, because propagateMoveDeleteUndelete is never part of a loop
         $result = $result && $this->updatePerson($personTitle, 'child', 'child_of_family', $newTitleString, $text, $textChanged);
     }
     if (StructuredData::removeDuplicateLinks('husband|wife|child', $text)) {
         $textChanged = true;
     }
     $result = $result && $wgESINHandler->propagateSINMoveDeleteUndelete($this->title, 'family', $this->titleString, $newTitleString, $propagatedData, $text, $textChanged);
     if (!$result) {
         error_log("ERROR! Family move/delete/undelete not propagated: {$this->titleString} -> " . ($newTitleString ? $newTitleString : "[delete]") . "\n");
     }
     return $result;
 }
Exemple #24
0
 public static function readFamilyData($titleString, &$data, &$gedcomData, $includeRelativeData = false, $includeNonCompareData = false, $revid = 0, $timestamp = '')
 {
     $children = array();
     $data['familyTitle'][] = $titleString;
     if (GedcomUtil::isGedcomTitle($titleString)) {
         $title = null;
         $data['Exists'] = true;
         $xml = GedcomUtil::getGedcomXml($gedcomData, $titleString);
         $data['GedcomMatchTitle'] = (string) $xml['match'];
         $contents = GedcomUtil::getGedcomContents($gedcomData, $titleString);
     } else {
         $title = Title::newFromText($titleString, NS_FAMILY);
         $data['Exists'] = $title->exists();
         $p = new Family($titleString);
         $p->loadPage($revid);
         if ($revid) {
             $data['Revid'][] = $revid;
         }
         // for consistency with readPersonData
         $xml = $p->getPageXml();
         $contents = $p->getPageContents();
     }
     $husbandFound = $wifeFound = false;
     if ($includeRelativeData) {
         CompareForm::initPersonData('husband', $data);
         CompareForm::initPersonData('wife', $data);
     }
     if (isset($xml)) {
         foreach ($xml->event_fact as $ef) {
             $type = (string) $ef['type'];
             if ($type == Family::$MARRIAGE_TAG || $type == Family::$ALT_MARRIAGE_TAG) {
                 CompareForm::getDatePlace($ef, 'Marriagedate', 'Marriageplace', $data);
             } else {
                 if ($includeNonCompareData) {
                     CompareForm::getOtherEvent($ef, '', $data);
                 }
             }
         }
         if ($includeNonCompareData) {
             CompareForm::getSINContents($xml, $contents, '', $data);
         }
         if ($includeRelativeData) {
             $husbandFound = CompareForm::readRelativeData('husband', $xml->husband, $data, $gedcomData, true, false, $includeNonCompareData, $timestamp);
             $wifeFound = CompareForm::readRelativeData('wife', $xml->wife, $data, $gedcomData, true, false, $includeNonCompareData, $timestamp);
             $i = 0;
             foreach ($xml->child as $c) {
                 $childTitle = (string) $c['title'];
                 if ($childTitle) {
                     $children[$i] = array();
                     CompareForm::initPersonData('child', $children[$i]);
                     if (GedcomUtil::isGedcomTitle($childTitle)) {
                         $childRevid = 0;
                     } else {
                         $t = Title::newFromText($childTitle, NS_PERSON);
                         $childRevid = $timestamp ? StructuredData::getRevidForTimestamp($t, $timestamp) : 0;
                     }
                     CompareForm::readPersonData('child', $childTitle, $children[$i], $gedcomData, false, false, true, $includeNonCompareData, $childRevid);
                     $i++;
                 }
             }
         } else {
             $data['husbandTitle'] = array();
             foreach ($xml->husband as $m) {
                 $data['husbandTitle'][] = (string) $m['title'];
             }
             $data['wifeTitle'] = array();
             foreach ($xml->wife as $m) {
                 $data['wifeTitle'][] = (string) $m['title'];
             }
             $data['childTitle'] = array();
             foreach ($xml->child as $m) {
                 $data['childTitle'][] = (string) $m['title'];
             }
         }
     } else {
         if ($title && StructuredData::isRedirect($contents)) {
             $data['Redirect'] = true;
         }
     }
     if ($includeRelativeData && (!$husbandFound || !$wifeFound)) {
         list($fg, $fs, $mg, $ms) = StructuredData::parseFamilyTitle($titleString);
         if (!$husbandFound) {
             if ($fg) {
                 $data['husbandGiven'][] = $fg;
             }
             if ($fs) {
                 $data['husbandSurname'][] = $fs;
             }
         }
         if (!$wifeFound) {
             if ($mg) {
                 $data['wifeGiven'][] = $mg;
             }
             if ($ms) {
                 $data['wifeSurname'][] = $ms;
             }
         }
     }
     $data['Nomerge'] = CompareForm::getNomergeTitleStrings($title);
     if ($title) {
         $data['Updatable'] = CompareForm::isUpdatable($title, $contents);
     }
     return $children;
 }
Exemple #25
0
 function family($employee_id = '')
 {
     $data['page_name'] = '<b>Personal Data Sheet</b>';
     $data['section_name'] = '<b>Personal Information</b>';
     $data['focus_field'] = 'spouse_lname';
     $data['msg'] = '';
     $e = new Employee_m();
     $data['employee'] = $e->get_by_id($employee_id);
     $family = new Family();
     if (Input::get('op')) {
         $family->get_by_employee_id($employee_id);
         $family->employee_id = $employee_id;
         $family->spouse_lname = Input::get('spouse_lname');
         $family->spouse_fname = Input::get('spouse_fname');
         $family->spouse_mname = Input::get('spouse_mname');
         $family->spouse_occupation = Input::get('spouse_occupation');
         $family->spouse_employer = Input::get('spouse_employer');
         $family->spouse_biz_ad = Input::get('spouse_biz_ad');
         $family->spouse_tel = Input::get('spouse_tel');
         $family->father_lname = Input::get('father_lname');
         $family->father_fname = Input::get('father_fname');
         $family->father_mname = Input::get('father_mname');
         $family->mother_lname = Input::get('mother_lname');
         $family->mother_fname = Input::get('mother_fname');
         $family->mother_mname = Input::get('mother_mname');
         $family->save();
         // Children
         $c = new Children();
         $c->get_by_employee_id($employee_id);
         $c->delete_all();
         $children = Input::get('children');
         $children_birth_day = Input::get('children_birth_day');
         $i = 0;
         foreach ($children as $child) {
             if ($child != "") {
                 $c = new Children();
                 $c->employee_id = $employee_id;
                 $c->children = $children[$i];
                 $c->birth_date = $children_birth_day[$i];
                 $c->save();
             }
             $i++;
         }
         $data['msg'] = 'Family Background has been saved!';
     }
     $family = new Family();
     $data['family'] = $family->get_by_employee_id($employee_id);
     // Children===================================================
     $children = new Children();
     $children->order_by('birth_date');
     $children = $children->get_by_employee_id($employee_id);
     $i = 0;
     foreach ($children as $child) {
         $data['children']['name'][] = $child->children;
         $data['children']['birth_date'][] = $child->birth_date;
         $i++;
     }
     if ($i <= 14) {
         while ($i != 14) {
             $data['children']['name'][] = '';
             $data['children']['birth_date'][] = '';
             $i++;
         }
     }
     $data['selected'] = $e->office_id;
     // Use for office listbox
     $data['options'] = $this->options->office_options();
     $data['employee_id'] = $employee_id;
     $data['main_content'] = 'family';
     return View::make('includes/template', $data);
 }
Exemple #26
0
 private function updateImageContent($tag, $oldTitle, $newTitle, &$pd, &$text)
 {
     if ($newTitle) {
         if ($tag == 'person') {
             $new = Person::getPropagatedElement($tag, $newTitle, $pd);
         } else {
             // family
             $new = Family::getPropagatedElement($tag, $newTitle, $pd);
         }
     } else {
         $new = '';
     }
     $old = "<{$tag}[^>]*? title=\"" . StructuredData::protectRegexSearch(StructuredData::escapeXml($oldTitle)) . "\".*?/>\n";
     if (!preg_match('$' . $old . '$', $text)) {
         $old = "</image_data>";
         $new .= $old;
     }
     $result = preg_replace('$' . $old . '$', StructuredData::protectRegexReplace($new), $text);
     // if nothing changed, return empty string
     if ($result == $text) {
         $result = '';
     }
     return $result;
 }
Exemple #27
0
 /**
  * Used for general category browsing (which is really a search by category or family)
  * The URL manager passes the category request_url which we look up here
  */
 public function actionBrowse()
 {
     $strC = Yii::app()->getRequest()->getQuery('cat');
     $strB = Yii::app()->getRequest()->getQuery('brand');
     $strS = Yii::app()->getRequest()->getQuery('class_name');
     $strInv = '';
     //If we haven't passed any criteria, we just query the database
     $criteria = new CDbCriteria();
     $criteria->alias = 'Product';
     if (!empty($strC)) {
         $objCategory = Category::LoadByRequestUrl($strC);
         if ($objCategory) {
             $criteria->join = 'LEFT JOIN xlsws_product_category_assn as ProductAssn ON ProductAssn.product_id=Product.id';
             $intIdArray = array($objCategory->id);
             $intIdArray = array_merge($intIdArray, $objCategory->GetBranchPath());
             $criteria->addInCondition('category_id', $intIdArray);
             $this->pageTitle = $objCategory->PageTitle;
             $this->pageDescription = $objCategory->PageDescription;
             $this->pageImageUrl = $objCategory->CategoryImage;
             $this->breadcrumbs = $objCategory->Breadcrumbs;
             $this->pageHeader = Yii::t('category', $objCategory->label);
             $this->subcategories = $objCategory->getSubcategoryTree($this->MenuTree);
             if ($objCategory->custom_page) {
                 $this->custom_page_content = $objCategory->customPage->page;
             }
             $this->canonicalUrl = $objCategory->getCanonicalUrl();
         }
     }
     if (!empty($strB)) {
         $objFamily = Family::LoadByRequestUrl($strB);
         if ($objFamily) {
             $criteria->addCondition('family_id = :id');
             $criteria->params = array(':id' => $objFamily->id);
             $this->pageTitle = $objFamily->PageTitle;
             $this->pageHeader = $objFamily->family;
             $this->canonicalUrl = $objFamily->getCanonicalUrl();
         }
     }
     if (!empty($strS)) {
         $objClasses = Classes::LoadByRequestUrl($strS);
         if ($objClasses) {
             $criteria->addCondition('class_id = :id');
             $criteria->params = array(':id' => $objClasses->id);
             $this->pageHeader = $objClasses->class_name;
             $this->canonicalUrl = $objClasses->getCanonicalUrl();
         }
     }
     if (_xls_get_conf('INVENTORY_OUT_ALLOW_ADD') == Product::InventoryMakeDisappear) {
         $criteria->addCondition('(inventory_avail>0 OR inventoried=0)');
     }
     if (!_xls_get_conf('CHILD_SEARCH') || empty($strQ)) {
         $criteria->addCondition('Product.parent IS NULL');
     }
     if (Product::HasFeatured() && empty($strS) && empty($strB) && empty($strC)) {
         $criteria->addCondition('featured=1');
         $this->pageHeader = 'Featured Products';
     }
     $criteria->addCondition('web=1');
     $criteria->addCondition('current=1');
     $criteria->order = 'Product.' . _xls_get_sort_order();
     $productsGrid = new ProductGrid($criteria);
     $this->returnUrl = $this->canonicalUrl;
     $this->pageImageUrl = "";
     if ($strB == '*') {
         $familiesCriteria = new CDbCriteria();
         $familiesCriteria->order = 'family';
         if (CPropertyValue::ensureBoolean(Yii::app()->params['DISPLAY_EMPTY_CATEGORY']) === false) {
             $familiesCriteria->addCondition('child_count > 0');
         }
         $families = Family::model()->findAll($familiesCriteria);
         $this->render('brands', array('model' => $families));
     } else {
         $this->render('grid', array('model' => $productsGrid->getProductGrid(), 'item_count' => $productsGrid->getNumberOfRecords(), 'page_size' => Yii::app()->params['PRODUCTS_PER_PAGE'], 'items_count' => $productsGrid->getNumberOfRecords(), 'pages' => $productsGrid->getPages()));
     }
 }
    function printView()
    {
        $show_form = true;
        if (!empty($_POST['move_to'])) {
            if (!$this->_person->haveLock()) {
                // lock expired
                if ($this->_person->acquireLock()) {
                    // managed to reacquire lock - ask them to try again
                    ?>
					<div class="failure">Your changes could not be saved because your lock had expired.  Try making your changes again using the form below</div>
					<?php 
                    $show_form = true;
                } else {
                    // could not re-acquire lock
                    ?>
					<div class="failure">Your changes could not be saved because your lock has expired.  The lock has now been acquired by another user.  Wait some time for them to finish and then <a href="?view=_edit_person&personid=<?php 
                    echo $this->_person->id;
                    ?>
">try again</a></div>
					<?php 
                    $show_form = false;
                }
            } else {
                // must have been some other problem
                $show_form = true;
            }
        } else {
            // hasn't been submitted yet
            if (!$this->_person->acquireLock()) {
                ?>
				<div class="failure">This person cannot currently be edited because another user has the lock.  Wait some time for them to finish and then <a href="?view=_edit_person&personid=<?php 
                echo $this->_person->id;
                ?>
">try again</a></div>
				<?php 
                $show_form = false;
            }
        }
        if ($show_form) {
            ?>
			<form method="post" class="form-horizontal">
				<div class="control-group">
					<label class="control-label">Current Family</label>
					<div class="controls controls-text">
						<?php 
            echo $this->_person->printFieldValue('familyid');
            ?>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">New Family</label>
					<div class="controls">
						<p class="radio-list">
						<label class="radio inline">
							<input type="radio" name="move_to" value="existing" />
							Move to an existing family:
						</label>
						<?php 
            Family::printSingleFinder('familyid');
            ?>
						</p>

						<p class="radio-list">
						<label class="radio">
							<input type="radio" name="move_to" value="new" />
							Create a new family containing only this person
							<br />(Details will be copied from the old family)</span>
						</label>
						
						</p>
					</div>
				</div>
				<div class="controls">
					<button type="submit" class="btn">Go</button>
					<a class="btn" href="?view=persons&personid=<?php 
            echo $this->_person->id;
            ?>
">Cancel</a>
				</div>
			</form>
			<script type="text/javascript">
				setTimeout('showLockExpiryWarning()', <?php 
            echo (strtotime('+' . LOCK_LENGTH, 0) - 60) * 1000;
            ?>
);
				setTimeout('showLockExpiredWarning()', <?php 
            echo strtotime('+' . LOCK_LENGTH, 0) * 1000;
            ?>
);
			</script>
			<?php 
        }
    }
Exemple #29
0
 /**
  * Static helper function to sort an array of families by marriage date
  *
  * @param Family $x
  * @param Family $y
  *
  * @return int
  */
 public static function compareMarrDate(Family $x, Family $y)
 {
     return Date::compare($x->getMarriageDate(), $y->getMarriageDate());
 }
Exemple #30
0
 function page1($employee_id)
 {
     $this->load->helper('settings');
     $this->load->library('fpdf');
     //define('FPDF_FONTPATH',$this->config->item('fonts_path'));
     $this->load->library('fpdi');
     //$this->load->model('Personal_Info');
     //Get personal info
     //$pi = $this->Personal_Info->get_personal_info($employee_id);
     $pi = new Personal();
     $pi->get_by_employee_id($employee_id);
     //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/page1.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);
     /*******************************
      *START PERSONAL INFORMATION ==
      ******************************/
     $split[0] = '';
     $split[1] = '';
     $split[2] = '';
     $split[3] = '';
     $split[4] = '';
     $split[5] = '';
     $split[6] = '';
     $split[7] = '';
     $split[8] = '';
     $split[9] = '';
     $split[10] = '';
     $split[11] = '';
     $split[12] = '';
     $split[13] = '';
     $split[14] = '';
     $split[15] = '';
     $split[16] = '';
     $split[17] = '';
     $split[18] = '';
     $split[19] = '';
     $split[20] = '';
     $split[21] = '';
     $split[22] = '';
     $split[23] = '';
     $split[24] = '';
     $split[25] = '';
     $split[26] = '';
     $split[27] = '';
     $split[28] = '';
     $split[29] = '';
     //$pdf->MultiCell(0,3,"hello this is a sample \nlong text with line break" ,'',1,'L',false);
     //$pdf->MultiCell(0,3,"hello this is a sample \nlong text with line break" ,'',1,'L',false);
     //$pdf->MultiCell(0,3,"hello this is a sample \nlong text with line break" ,'',1,'L',false);
     $this->load->helper('text');
     //$pdf->MultiCell(0,3,word_wrap("hello this is a sample nlong text with line break", 15) ,'',1,'L',false);
     $split = str_split($pi->lname);
     // Write something ==LAST NAME =========
     $pdf->SetXY(39, 53);
     $pdf->Write(0, $split[0]);
     $pdf->SetX(44);
     $pdf->Write(0, $split[1]);
     $pdf->SetX(49);
     $pdf->Write(0, $split[2]);
     $pdf->SetX(54);
     $pdf->Write(0, $split[3]);
     $pdf->SetX(60);
     $pdf->Write(0, $split[4]);
     $pdf->SetX(65);
     $pdf->Write(0, $split[5]);
     $pdf->SetX(70);
     $pdf->Write(0, $split[6]);
     $pdf->SetX(75);
     $pdf->Write(0, $split[7]);
     $pdf->SetX(81);
     $pdf->Write(0, $split[8]);
     $pdf->SetX(86);
     $pdf->Write(0, $split[9]);
     $pdf->SetX(91);
     $pdf->Write(0, $split[10]);
     $pdf->SetX(96);
     $pdf->Write(0, $split[11]);
     $pdf->SetX(101);
     $pdf->Write(0, $split[12]);
     $pdf->SetX(106);
     $pdf->Write(0, $split[13]);
     $pdf->SetX(111);
     $pdf->Write(0, $split[14]);
     $pdf->SetX(116);
     $pdf->Write(0, $split[15]);
     $pdf->SetX(121);
     $pdf->Write(0, $split[16]);
     $pdf->SetX(126);
     $pdf->Write(0, $split[17]);
     $pdf->SetX(131);
     $pdf->Write(0, $split[18]);
     $pdf->SetX(137);
     $pdf->Write(0, $split[19]);
     $pdf->SetX(142);
     $pdf->Write(0, $split[20]);
     $pdf->SetX(147);
     $pdf->Write(0, $split[21]);
     $pdf->SetX(152);
     $pdf->Write(0, $split[22]);
     $pdf->SetX(157);
     $pdf->Write(0, $split[23]);
     $pdf->SetX(163);
     $pdf->Write(0, $split[24]);
     $pdf->SetX(168);
     $pdf->Write(0, $split[25]);
     $pdf->SetX(173);
     $pdf->Write(0, $split[26]);
     $pdf->SetX(178);
     $pdf->Write(0, $split[27]);
     $pdf->SetX(183);
     $pdf->Write(0, $split[28]);
     $pdf->SetX(188);
     $pdf->Write(0, $split[29]);
     // line break
     //=========FIRST NAME====
     $split = str_split($pi->fname);
     $pdf->Ln(6);
     $pdf->SetX(39);
     $pdf->Write(0, $split[0]);
     $pdf->SetX(44);
     $pdf->Write(0, $split[1]);
     $pdf->SetX(49);
     $pdf->Write(0, $split[2]);
     $pdf->SetX(54);
     $pdf->Write(0, $split[3]);
     $pdf->SetX(60);
     $pdf->Write(0, $split[4]);
     $pdf->SetX(65);
     $pdf->Write(0, $split[5]);
     $pdf->SetX(70);
     $pdf->Write(0, $split[6]);
     $pdf->SetX(75);
     $pdf->Write(0, $split[7]);
     $pdf->SetX(81);
     $pdf->Write(0, $split[8]);
     $pdf->SetX(86);
     $pdf->Write(0, $split[9]);
     $pdf->SetX(91);
     $pdf->Write(0, $split[10]);
     $pdf->SetX(96);
     $pdf->Write(0, $split[11]);
     $pdf->SetX(101);
     $pdf->Write(0, $split[12]);
     $pdf->SetX(106);
     $pdf->Write(0, $split[13]);
     $pdf->SetX(111);
     $pdf->Write(0, $split[14]);
     $pdf->SetX(116);
     $pdf->Write(0, $split[15]);
     $pdf->SetX(121);
     $pdf->Write(0, $split[16]);
     $pdf->SetX(126);
     $pdf->Write(0, $split[17]);
     $pdf->SetX(131);
     $pdf->Write(0, $split[18]);
     $pdf->SetX(137);
     $pdf->Write(0, $split[19]);
     $pdf->SetX(142);
     $pdf->Write(0, $split[20]);
     $pdf->SetX(147);
     $pdf->Write(0, $split[21]);
     $pdf->SetX(152);
     $pdf->Write(0, $split[22]);
     $pdf->SetX(157);
     $pdf->Write(0, $split[23]);
     $pdf->SetX(163);
     $pdf->Write(0, $split[24]);
     $pdf->SetX(168);
     $pdf->Write(0, $split[25]);
     $pdf->SetX(173);
     $pdf->Write(0, $split[26]);
     $pdf->SetX(178);
     $pdf->Write(0, $split[27]);
     $pdf->SetX(183);
     $pdf->Write(0, $split[28]);
     $pdf->SetX(188);
     $pdf->Write(0, $split[29]);
     //======== MNAME
     $split = str_split($pi->mname);
     // line break
     $pdf->Ln(6);
     $pdf->SetX(39);
     $pdf->Write(0, $split[0]);
     $pdf->SetX(44);
     $pdf->Write(0, $split[1]);
     $pdf->SetX(49);
     $pdf->Write(0, $split[2]);
     $pdf->SetX(54);
     $pdf->Write(0, $split[3]);
     $pdf->SetX(60);
     $pdf->Write(0, $split[4]);
     $pdf->SetX(65);
     $pdf->Write(0, $split[5]);
     $pdf->SetX(70);
     $pdf->Write(0, $split[6]);
     $pdf->SetX(75);
     $pdf->Write(0, $split[7]);
     $pdf->SetX(81);
     $pdf->Write(0, $split[8]);
     $pdf->SetX(86);
     $pdf->Write(0, $split[9]);
     $pdf->SetX(91);
     $pdf->Write(0, $split[10]);
     $pdf->SetX(96);
     $pdf->Write(0, $split[11]);
     $pdf->SetX(101);
     $pdf->Write(0, $split[12]);
     $pdf->SetX(106);
     $pdf->Write(0, $split[13]);
     $pdf->SetX(111);
     $pdf->Write(0, $split[14]);
     $pdf->SetX(116);
     $pdf->Write(0, $split[15]);
     $pdf->SetX(121);
     $pdf->Write(0, $split[16]);
     $pdf->SetX(126);
     $pdf->Write(0, $split[17]);
     $pdf->SetX(131);
     $pdf->Write(0, $split[18]);
     $pdf->SetX(137);
     $pdf->Write(0, $split[19]);
     $pdf->SetX(142);
     $pdf->Write(0, $split[20]);
     $pdf->SetX(147);
     $pdf->Write(0, $split[21]);
     $pdf->SetX(152);
     $pdf->Write(0, $split[22]);
     $pdf->SetX(157);
     $pdf->Write(0, $split[23]);
     $pdf->SetX(163);
     $pdf->Write(0, $split[24]);
     $pdf->SetX(168);
     $pdf->Write(0, $split[25]);
     $pdf->SetX(173);
     $pdf->Write(0, $split[26]);
     $pdf->SetX(178);
     $pdf->Write(0, $split[27]);
     $pdf->SetX(183);
     $pdf->Write(0, $split[28]);
     $pdf->SetX(188);
     $pdf->Write(0, $split[29]);
     $pdf->SetX(189);
     $pdf->Write(0, $pi->extension);
     $date = $pi->birth_date;
     list($year, $month, $day) = explode('-', $date);
     $pdf->Ln(6);
     $pdf->SetX(67);
     $pdf->Write(0, $month . '-' . $day . '-' . $year);
     $res_address = splitstroverflow($pi->res_address, 30);
     $pdf->SetX(126);
     $pdf->Write(0, $res_address[0]);
     $pdf->Ln(4);
     $pdf->SetX(39);
     $pdf->Write(0, $pi->birth_place);
     $pdf->SetX(126);
     $pdf->Write(0, $res_address[1]);
     $pdf->Ln(5);
     if ($pi->sex == 'M') {
         $setx = 41.5;
     }
     if ($pi->sex == 'F') {
         $setx = 58;
     }
     $pdf->SetX($setx);
     $pdf->Write(0, 'X');
     if ($pi->civil_status == 1) {
         $pdf->SetXY(41.5, 85);
         $pdf->Write(0, 'X');
     }
     if ($pi->civil_status == 2) {
         $pdf->SetXY(41.5, 89);
         $pdf->Write(0, 'X');
     }
     if ($pi->civil_status == 3) {
         $pdf->SetXY(41.5, 94.5);
         $pdf->Write(0, 'X');
     }
     if ($pi->civil_status == 4) {
         $pdf->SetXY(64, 85);
         $pdf->Write(0, 'X');
     }
     if ($pi->civil_status == 5) {
         $pdf->SetXY(64, 89);
         $pdf->Write(0, 'X');
     }
     if ($pi->civil_status == 6) {
         $pdf->SetXY(64, 94.5);
         $pdf->Write(0, 'X');
     }
     //citizeship
     $pdf->SetXY(39, 103);
     $pdf->Write(0, $pi->citizenship);
     $pdf->Ln(5.2);
     $pdf->SetX(39);
     $pdf->Write(0, $pi->height);
     $pdf->Ln(5.2);
     $pdf->SetX(39);
     $pdf->Write(0, $pi->weight);
     $pdf->Ln(5.2);
     $pdf->SetX(39);
     $pdf->Write(0, $pi->blood_type);
     $pdf->Ln(4);
     $pdf->SetX(39);
     $pdf->Write(0, $pi->gsis);
     $pdf->Ln(5);
     $pdf->SetX(39);
     $pdf->Write(0, $pi->pagibig);
     $pdf->Ln(4);
     $pdf->SetX(39);
     $pdf->Write(0, $pi->philhealth);
     $pdf->Ln(5);
     $pdf->SetX(39);
     $pdf->Write(0, $pi->sss);
     $pdf->SetXY(126, 85);
     $pdf->Write(0, $pi->res_zip);
     $pdf->Ln(5);
     $pdf->SetX(126);
     $pdf->Write(0, $pi->res_tel);
     $pdf->Ln(5);
     $pdf->SetX(126);
     $permanent_address = splitstroverflow($pi->permanent_address, 30);
     $pdf->Write(0, $permanent_address[0]);
     $pdf->Ln(4);
     $pdf->SetX(126);
     $pdf->Write(0, $permanent_address[1]);
     $pdf->Ln(15);
     $pdf->SetX(126);
     $pdf->Write(0, $pi->permanent_zip);
     $pdf->Ln(4);
     $pdf->SetX(126);
     $pdf->Write(0, $pi->permanent_tel);
     $pdf->Ln(4.3);
     $pdf->SetX(126);
     $pdf->Write(0, $pi->email);
     $pdf->Ln(4.9);
     $pdf->SetX(126);
     $pdf->Write(0, $pi->cp);
     $pdf->Ln(4.3);
     $pdf->SetX(126);
     $pdf->Write(0, $pi->agency_employee_no);
     $pdf->Ln(4.3);
     $pdf->SetX(126);
     $pdf->Write(0, $pi->tin);
     /*******************************
      *END PERSONAL INFORMATION =====
      ******************************/
     //======================================================================
     /*******************************
      *START FAMILY BACK GROUND=======
      ******************************/
     //Get family background
     //$fb = $this->Family_Background->get_family_background($employee_id);
     $fb = new Family();
     $fb->get_by_employee_id($employee_id);
     $pdf->SetXY(39, 146);
     $pdf->Write(0, $fb->spouse_lname);
     $pdf->Ln(4.3);
     $pdf->SetX(39);
     $pdf->Write(0, $fb->spouse_fname);
     $pdf->Ln(4.3);
     $pdf->SetX(39);
     $pdf->Write(0, $fb->spouse_mname);
     $pdf->Ln(5);
     $pdf->SetX(39);
     $pdf->Write(0, $fb->spouse_occupation);
     $pdf->Ln(5);
     $pdf->SetX(39);
     $pdf->Write(0, $fb->spouse_employer);
     $pdf->Ln(5);
     $pdf->SetX(39);
     $pdf->Write(0, $fb->spouse_biz_ad);
     $pdf->Ln(5);
     $pdf->SetX(39);
     $pdf->Write(0, $fb->spouse_tel);
     $pdf->Ln(9);
     $pdf->SetX(57);
     $pdf->Write(0, $fb->father_lname);
     $pdf->Ln(4.5);
     $pdf->SetX(57);
     $pdf->Write(0, $fb->father_fname);
     $pdf->Ln(4.5);
     $pdf->SetX(57);
     $pdf->Write(0, $fb->father_mname);
     $pdf->Ln(4.5);
     $pdf->SetX(57);
     $pdf->Write(0, $fb->mother_lname);
     $pdf->Ln(4.5);
     $pdf->SetX(57);
     $pdf->Write(0, $fb->mother_fname);
     $pdf->Ln(4.5);
     $pdf->SetX(57);
     $pdf->Write(0, $fb->mother_mname);
     /*******************************
      *END FAMILY BACK GROUND=======
      ******************************/
     //=============================================================================
     /*******************************
      *START CHILDREN================
      ******************************/
     //$children = $this->Children->get_child($employee_id);
     $children = new Children();
     $children->order_by('birth_date');
     $children->get_by_employee_id($employee_id);
     $pdf->SetXY(110, 145);
     $i = 1;
     $pdf->SetFont('Arial', '', 10);
     foreach ($children as $child) {
         if ($i == 7 || $i == 9 || $i == 11) {
             $pdf->Ln(4.5);
         } else {
             $pdf->Ln(5);
         }
         $pdf->SetX(110);
         $pdf->Write(0, $child->children);
         $date = $child->birth_date;
         list($year, $month, $day) = explode('-', $date);
         $pdf->SetX(170);
         $pdf->Write(0, $month . '/' . $day . '/' . $year);
         $i++;
     }
     /*******************************
      *END CHILDREN==================
      ******************************/
     //=====================================================================
     /*******************************
      *START EDUC==================
      ******************************/
     $e = new Education();
     //$educs = $this->Educational_Background->get_educ($employee_id, $level = 1);
     $educs = $e->get_single_educ($employee_id, $level = 1);
     $pdf->SetFont('Arial', '', 10);
     $pdf->SetXY(39, 233);
     //
     /*******************************
      *END EDUC==================
      ******************************/
     foreach ($educs as $educ) {
         $sch = wordwrap(ucwords(strtolower($educ->school_name)), 23, "|");
         $sch = explode("|", $sch);
         //$degree = wordwrap($educ->degree_course, 15, "|");
         $degree = wordwrap(ucwords(strtolower($educ->degree_course)), 15, "|");
         $degree = explode("|", $degree);
         $pdf->Write(0, $sch[0]);
         $pdf->SetX(78);
         $pdf->Write(0, $degree[0]);
         $pdf->SetX(107);
         $pdf->Write(0, $educ->year_graduated);
         $pdf->SetX(130);
         $pdf->Write(0, $educ->highest_grade);
         $pdf->SetX(150);
         $pdf->Write(0, $educ->attend_from);
         $pdf->SetX(163);
         $pdf->Write(0, $educ->attend_to);
         $pdf->SetX(177);
         $pdf->Write(0, $educ->scholarship);
         $pdf->Ln(3);
         $pdf->SetX(39);
         $pdf->Write(0, $sch[1]);
         $pdf->SetX(78);
         $pdf->Write(0, $degree[1]);
         $pdf->Ln(3);
         $pdf->SetX(39);
         $pdf->Write(0, $sch[2]);
         $pdf->SetX(78);
         $pdf->Write(0, $degree[2]);
         $pdf->Ln(3);
         $pdf->SetX(39);
         $pdf->Write(0, $sch[3]);
         $pdf->SetX(78);
         $pdf->Write(0, $degree[3]);
     }
     //secondary
     // $educs = $this->Educational_Background->get_educ($employee_id, $level = 2);
     $educs = $e->get_single_educ($employee_id, $level = 2);
     $pdf->SetXY(39, 246);
     foreach ($educs as $educ) {
         //$sch = wordwrap($educ->school_name, 23, "|");
         $sch = wordwrap(ucwords(strtolower($educ->school_name)), 23, "|");
         $sch = explode("|", $sch);
         //$degree = wordwrap($educ->degree_course, 15, "|");
         $degree = wordwrap(ucwords(strtolower($educ->degree_course)), 15, "|");
         $degree = explode("|", $degree);
         $pdf->Write(0, $sch[0]);
         $pdf->SetX(78);
         $pdf->Write(0, $degree[0]);
         $pdf->SetX(107);
         $pdf->Write(0, $educ->year_graduated);
         $pdf->SetX(130);
         $pdf->Write(0, $educ->highest_grade);
         $pdf->SetX(150);
         $pdf->Write(0, $educ->attend_from);
         $pdf->SetX(163);
         $pdf->Write(0, $educ->attend_to);
         $pdf->SetX(177);
         $pdf->Write(0, $educ->scholarship);
         $pdf->Ln(3);
         $pdf->SetX(39);
         $pdf->Write(0, $sch[1]);
         $pdf->SetX(78);
         $pdf->Write(0, $degree[1]);
         $pdf->Ln(3);
         $pdf->SetX(39);
         $pdf->Write(0, $sch[2]);
         $pdf->SetX(78);
         $pdf->Write(0, $degree[2]);
         $pdf->Ln(3);
         $pdf->SetX(39);
         $pdf->Write(0, $sch[3]);
         $pdf->SetX(78);
         $pdf->Write(0, $degree[3]);
     }
     //vocational
     // $educs = $this->Educational_Background->get_educ($employee_id, $level = 3);
     $educs = $e->get_single_educ($employee_id, $level = 3);
     $pdf->SetXY(39, 259);
     foreach ($educs as $educ) {
         //$sch = wordwrap($educ->school_name, 23, "|");
         $sch = wordwrap(ucwords(strtolower($educ->school_name)), 23, "|");
         $sch = explode("|", $sch);
         //$degree = wordwrap($educ->degree_course, 15, "|");
         $degree = wordwrap(ucwords(strtolower($educ->degree_course)), 15, "|");
         $degree = explode("|", $degree);
         $pdf->Write(0, $sch[0]);
         $pdf->SetX(78);
         $pdf->Write(0, $degree[0]);
         $pdf->SetX(107);
         $pdf->Write(0, $educ->year_graduated);
         $pdf->SetX(130);
         $pdf->Write(0, $educ->highest_grade);
         $pdf->SetX(150);
         $pdf->Write(0, $educ->attend_from);
         $pdf->SetX(163);
         $pdf->Write(0, $educ->attend_to);
         $pdf->SetX(177);
         $pdf->Write(0, $educ->scholarship);
         $pdf->Ln(3);
         $pdf->SetX(39);
         $pdf->Write(0, $sch[1]);
         $pdf->SetX(78);
         $pdf->Write(0, $degree[1]);
         $pdf->Ln(3);
         $pdf->SetX(39);
         $pdf->Write(0, $sch[2]);
         $pdf->SetX(78);
         $pdf->Write(0, $degree[2]);
         $pdf->Ln(3);
         $pdf->SetX(39);
         $pdf->Write(0, $sch[3]);
         $pdf->SetX(78);
         $pdf->Write(0, $degree[3]);
     }
     //college
     // $educs = $this->Educational_Background->get_educ($employee_id, $level = 4);
     $educs = $e->get_single_educ($employee_id, $level = 4);
     $pdf->SetXY(39, 274);
     foreach ($educs as $educ) {
         //$sch = wordwrap($educ->school_name, 23, "|");
         $sch = wordwrap(ucwords(strtolower($educ->school_name)), 23, "|");
         $sch = explode("|", $sch);
         //$degree = wordwrap($educ->degree_course, 15, "|");
         $degree = wordwrap(ucwords(strtolower($educ->degree_course)), 15, "|");
         $degree = explode("|", $degree);
         $pdf->Write(0, $sch[0]);
         $pdf->SetX(78);
         $pdf->Write(0, $degree[0]);
         $pdf->SetX(107);
         $pdf->Write(0, $educ->year_graduated);
         $pdf->SetX(130);
         $pdf->Write(0, $educ->highest_grade);
         $pdf->SetX(150);
         $pdf->Write(0, $educ->attend_from);
         $pdf->SetX(163);
         $pdf->Write(0, $educ->attend_to);
         $pdf->SetX(177);
         $pdf->Write(0, $educ->scholarship);
         $pdf->Ln(3);
         $pdf->SetX(39);
         $pdf->Write(0, $sch[1]);
         $pdf->SetX(78);
         $pdf->Write(0, $degree[1]);
         $pdf->Ln(3);
         $pdf->SetX(39);
         $pdf->Write(0, $sch[2]);
         $pdf->SetX(78);
         $pdf->Write(0, $degree[2]);
         $pdf->Ln(3);
         $pdf->SetX(39);
         $pdf->Write(0, $sch[3]);
         $pdf->SetX(78);
         $pdf->Write(0, $degree[3]);
     }
     //graduate studies
     //$educs = $this->Educational_Background->get_educ($employee_id, $level = 5);
     $educs = $e->get_single_educ($employee_id, $level = 5);
     $pdf->SetXY(39, 290);
     foreach ($educs as $educ) {
         //$sch = wordwrap($educ->school_name, 23, "|");
         $sch = wordwrap(ucwords(strtolower($educ->school_name)), 23, "|");
         $sch = explode("|", $sch);
         //$degree = wordwrap($educ->degree_course, 15, "|");
         $degree = wordwrap(ucwords(strtolower($educ->degree_course)), 15, "|");
         $degree = explode("|", $degree);
         $pdf->Write(0, $sch[0]);
         $pdf->SetX(78);
         $pdf->Write(0, $degree[0]);
         $pdf->SetX(107);
         $pdf->Write(0, $educ->year_graduated);
         $pdf->SetX(130);
         $pdf->Write(0, $educ->highest_grade);
         $pdf->SetX(150);
         $pdf->Write(0, $educ->attend_from);
         $pdf->SetX(163);
         $pdf->Write(0, $educ->attend_to);
         $pdf->SetX(177);
         $pdf->Write(0, $educ->scholarship);
         $pdf->Ln(3);
         $pdf->SetX(39);
         $pdf->Write(0, $sch[1]);
         $pdf->SetX(78);
         $pdf->Write(0, $degree[1]);
         $pdf->Ln(3);
         $pdf->SetX(39);
         $pdf->Write(0, $sch[2]);
         $pdf->SetX(78);
         $pdf->Write(0, $degree[2]);
         $pdf->Ln(3);
         $pdf->SetX(39);
         $pdf->Write(0, $sch[3]);
         $pdf->SetX(78);
         $pdf->Write(0, $degree[3]);
     }
     // Output
     //$pdf->Output('resources/pdfs/archives/page1_'.$employee_id.'.pdf', 'F');
     $pdf->Output('dtr/template/pds/page1_' . $employee_id . '.pdf', 'F');
     $this->pds[] = 'dtr/template/pds/page1_' . $employee_id . '.pdf';
     //$this->pds[] = 'resources/pdfs/archives/page1_'.$employee_id.'.pdf';
     //header("location:".base_url()."resources/pdfs/archives/page1_".$employee_id.'.pdf');
 }