Example #1
0
 public function getAssignFamilyTree()
 {
     $canDo = JoaktreeHelper::getActions();
     $tmp = JFactory::getApplication()->input->get('init', null, 'int');
     $procObject = (int) $tmp == 1 ? $this->initProcessObject() : $this->getProcessObject();
     if ($canDo->get('core.create') && $canDo->get('core.edit')) {
         switch ($procObject->status) {
             case 'start':
                 // continue
             // continue
             case 'starttree':
                 // continue
             // continue
             case 'progtree':
                 // continue
             // continue
             case 'endtree':
                 // continue
             // continue
             case 'treedef_1':
                 // continue
             // continue
             case 'treedef_2':
                 // continue
             // continue
             case 'treedef_3':
                 // continue
             // continue
             case 'treedef_4':
                 // continue
             // continue
             case 'treedef_5':
                 // continue
             // continue
             case 'treedef_6':
                 // continue
                 $familyTree = new jt_trees($procObject);
                 $resObject = $familyTree->assignFamilyTree();
                 $resObject->current = strftime('%H:%M:%S');
                 $this->setProcessObject($resObject);
                 $return = json_encode($resObject);
                 break;
             case 'endtreedef':
                 // we are done with this app
                 $resObject = $this->initProcessObject($procObject->japp_ids);
                 $resObject->current = strftime('%H:%M:%S');
                 $resObject->msg = JText::sprintf('JTPROCESS_END_MSG', $procObject->id);
                 $return = json_encode($resObject);
                 break;
                 // End: Addition for processing tree-persons
             // End: Addition for processing tree-persons
             case 'end':
             case 'error':
                 // continue
             // continue
             default:
                 // continue
                 $procObject->status = 'error';
                 $return = json_encode($procObject);
                 break;
         }
     } else {
         $procObject->status = 'error';
         $procObject->msg = JText::_('JT_NOTAUTHORISED');
         $return = json_encode($procObject);
     }
     return $return;
 }
Example #2
0
 public function getGedcom()
 {
     $canDo = JoaktreeHelper::getActions();
     $procObject = $this->getProcessObject();
     if ($canDo->get('core.create') && $canDo->get('core.edit')) {
         switch ($procObject->status) {
             case 'new':
                 $procObject->start = strftime('%H:%M:%S');
                 $procObject->msg = JText::sprintf('JTPROCESS_START_MSG', $procObject->id);
             case 'progress':
                 // continue
             // continue
             case 'endload':
                 // continue
             // continue
             case 'endpat':
                 // continue
                 $gedcomfile = new jt_gedcomfile2($procObject);
                 $resObject = $gedcomfile->process('all');
                 if ($resObject->status == 'endrel') {
                     $msg = jt_gedcomfile2::clear_gedcom();
                     if ($msg) {
                         $resObject->msg .= $msg . '<br />';
                     }
                 }
                 $resObject->current = strftime('%H:%M:%S');
                 $this->setProcessObject($resObject);
                 $return = json_encode($resObject);
                 break;
             case 'endrel':
                 // Start loop throuth the assign FT
                 $procObject->status = 'start';
                 // Addition for processing tree-persons
             // Addition for processing tree-persons
             case 'start':
                 // continue
             // continue
             case 'starttree':
                 // continue
             // continue
             case 'progtree':
                 // continue
             // continue
             case 'endtree':
                 // continue
             // continue
             case 'treedef_1':
                 // continue
             // continue
             case 'treedef_2':
                 // continue
             // continue
             case 'treedef_3':
                 // continue
             // continue
             case 'treedef_4':
                 // continue
             // continue
             case 'treedef_5':
                 // continue
             // continue
             case 'treedef_6':
                 // continue
                 $familyTree = new jt_trees($procObject);
                 $resObject = $familyTree->assignFamilyTree();
                 $resObject->current = strftime('%H:%M:%S');
                 $this->setProcessObject($resObject);
                 $return = json_encode($resObject);
                 break;
             case 'endtreedef':
                 // we are done
                 $procObject->status = 'end';
                 $procObject->current = strftime('%H:%M:%S');
                 $procObject->end = $procObject->current;
                 $this->setLastUpdateDateTime();
                 $this->setInitialChar();
                 $this->setProcessObject($procObject);
                 $return = json_encode($procObject);
                 break;
                 // End: Addition for processing tree-persons
             // End: Addition for processing tree-persons
             case 'end':
                 // store first empty object
                 $appId = $procObject->id;
                 $this->initObject($procObject->japp_ids);
                 $newObject = $this->getProcessObject();
                 $newObject->msg = JText::sprintf('JTPROCESS_END_MSG', $appId);
                 $return = json_encode($newObject);
                 break;
             case 'error':
                 // continue
             // continue
             default:
                 // continue
                 break;
         }
     } else {
         $procObject->status = 'error';
         $procObject->msg = JText::_('JT_NOTAUTHORISED');
         $return = json_encode($procObject);
     }
     return $return;
 }