function fetchJobSpecInfo($value)
{
    $lan = new Language();
    require $lan->getLangPath("full.php");
    $jobTitle = new JobTitle();
    $status = $jobTitle->getJobStatusFromTitle($value);
    $stat[] = array(0 => '', 1 => '0', 2 => "-- {$lang_hremp_selempstat} --");
    for ($i = 0; $i < count($status); $i++) {
        $stat[] = $status[$i];
    }
    $status = $stat;
    $view_controller = new ViewController();
    $response = new xajaxResponse();
    $xajaxFiller = new xajaxElementFiller();
    $objResponse = $xajaxFiller->cmbFillerById($response, $status, 1, 'frmEmp.empstatpp', 'cmbType');
    $jobSpec = $view_controller->getJobSpecForJob($value);
    if (empty($jobSpec)) {
        $jobSpecName = '';
        $jobSpecDuties = '';
    } else {
        $jobSpecName = CommonFunctions::escapeHtml($jobSpec->getName());
        $jobSpecDuties = nl2br(CommonFunctions::escapeHtml($jobSpec->getDuties()));
    }
    $response->addAssign('jobSpecName', 'innerHTML', $jobSpecName);
    $response->addAssign('jobSpecDuties', 'innerHTML', $jobSpecDuties);
    $response->addAssign('status', 'innerHTML', '');
    $response->addScript('reselectEmpStatus();');
    return $response->getXML();
}
Example #2
0
 public static function CallRoute($path)
 {
     $view_name = array();
     preg_match("/^([A-Za-z]*)\\/?/", $path, $vn);
     $view_name = "";
     if (isset($vn[1]) && !empty($vn[1])) {
         $view_name = $vn[1];
     } else {
         $view_name = "Main";
     }
     $view = "";
     $view = ViewController::FindView($view_name);
     if (!$view) {
         $view = "MainView";
     } else {
         $path = str_replace($view_name, "", $path);
     }
     if (strlen($path) > 0) {
         if ($result = ViewController::FindMethodMyURL($view, $path)) {
             $method = $result[0];
             $params = $result[1];
             return ViewController::$view()->{$method}($params);
         }
     } else {
         return ViewController::$view()->Main();
     }
 }
function populateStates($value, $oldState)
{
    $view_controller = new ViewController();
    $provlist = $view_controller->xajaxObjCall($value, 'LOC', 'province');
    $objResponse = new xajaxResponse();
    $xajaxFiller = new xajaxElementFiller();
    $xajaxFiller->setDefaultOptionName($GLOBALS['lang_Common_Select']);
    if ($provlist) {
        $objResponse->addAssign('lrState', 'innerHTML', '<select name="txtState" id="txtState" class="formSelect"><option value="0">--- ' . $GLOBALS['lang_Common_Select'] . ' ---</option></select>');
        $objResponse = $xajaxFiller->cmbFillerById($objResponse, $provlist, 1, 'frmGenInfo.lrState', 'txtState');
    } else {
        $objResponse->addAssign('lrState', 'innerHTML', '<input type="text" name="txtState" id="txtState" class="formInputText" value="' . $oldState . '">');
    }
    $objResponse->addAssign('status', 'innerHTML', '');
    return $objResponse->getXML();
}
Example #4
0
 public static function ScanViews()
 {
     self::$Views = array();
     foreach (glob(PathDriver::$ROOT_DIR . PathDriver::VIEWS . "*[A-Za-z]View") as $value) {
         $name = str_replace(PathDriver::$ROOT_DIR . PathDriver::VIEWS, "", $value);
         self::$Views[] = $name;
     }
 }
Example #5
0
function fetchJobSpecInfo($value)
{
    $view_controller = new ViewController();
    $response = new xajaxResponse();
    $jobSpec = $view_controller->getJobSpecForJob($value);
    if (empty($jobSpec)) {
        $jobSpecName = '';
        $jobSpecDuties = '';
    } else {
        $jobSpecName = CommonFunctions::escapeHtml($jobSpec->getName());
        $jobSpecDuties = nl2br(CommonFunctions::escapeHtml($jobSpec->getDuties()));
    }
    $response->addAssign('jobSpecName', 'innerHTML', $jobSpecName);
    $response->addAssign('jobSpecDuties', 'innerHTML', $jobSpecDuties);
    $response->addAssign('status', 'innerHTML', '');
    return $response->getXML();
}
 protected function renderLocation($location, $viewType, $layout = false, array $params = array())
 {
     switch ($viewType) {
         case 'full':
             $params += $this->getViewFullParams($location);
             break;
     }
     return parent::renderLocation($location, $viewType, $layout, $params);
 }
Example #7
0
function populateStates($value)
{
    $view_controller = new ViewController();
    $provlist = $view_controller->xajaxObjCall($value, 'LOC', 'province');
    $objResponse = new xajaxResponse();
    $xajaxFiller = new xajaxElementFiller();
    $xajaxFiller->setDefaultOptionName($GLOBALS['lang_Common_Select']);
    if ($provlist) {
        $objResponse->addAssign('lrState', 'innerHTML', '<select name="txtState" id="txtState"><option value="0">--- ' . $GLOBALS['lang_Common_Select'] . ' ---</option></select>');
        $objResponse = $xajaxFiller->cmbFillerById($objResponse, $provlist, 1, 'lrState', 'txtState');
    } else {
        $objResponse->addAssign('lrState', 'innerHTML', '<input type="text" name="txtState" id="txtState" value="">');
    }
    $objResponse->addScript('document.getElementById("txtState").Focus();');
    $objResponse->addScript("document.frmLocation.txtDistrict.options.length = 1;");
    $objResponse->addAssign('status', 'innerHTML', '');
    return $objResponse->getXML();
}
Example #8
0
 /**
  * Tests getJobSpecForJob method.
  */
 public function testGetJobSpecForJob()
 {
     $viewController = new ViewController();
     // invalid job title id
     $spec = $viewController->getJobSpecForJob('JOB010');
     $this->assertNull($spec);
     // job title with no job spec assigned
     $spec = $viewController->getJobSpecForJob('JOB001');
     $this->assertNull($spec);
     // job id with job spec assigned
     $spec = $viewController->getJobSpecForJob('JOB002');
     $this->assertNotNull($spec);
     $expected = new JobSpec();
     $expected->setId(1);
     $expected->setName('Spec 1');
     $expected->setDesc('Desc 1');
     $expected->setDuties('duties 1');
     $this->assertEquals($expected, $spec);
 }
 public function indexAction()
 {
     $this->view->title = "Contact";
     $this->view->host = $this->_host;
     $db = Zend_Registry::get('db');
     $template = $db->fetchAll("SELECT output FROM templates where defaultTemplate = '1'");
     $content = "aaaa";
     //$this->view->hits = $hits;
     if (!empty($template)) {
         $out = ViewController::_templatePrepare($template[0]['output'], $content);
         $this->view->output = $out;
     }
 }
Example #10
0
 public function run($code)
 {
     $args = $this->app->args;
     switch ($code) {
         case 404:
             $args['title'] = '404 Not Found';
             break;
         case 500:
             $args['title'] = '500 Internal Server Error';
             break;
         default:
             throw new \exception('illegal error code.');
             break;
     }
     $args['e_code'] = $code;
     parent::render('error.twig', $args);
 }
Example #11
0
 function reDirect($getArr, $postArr, $object = null)
 {
     $form_creator = new FormCreator($getArr, $postArr);
     switch ($getArr['reqcode']) {
         case 'JSP':
             $form_creator->formPath = '/templates/hrfunct/hrempjobspec.php';
             $ejobsp = new EmpJobSpec();
             $empinfo = new EmpInfo();
             $jdcat = new JDCategory();
             $form_creator->popArr['empdet'] = $empinfo->filterEmpMain($getArr['id']);
             $form_creator->popArr['catlist'] = $jdcat->getJDCatCodes();
             if (isset($getArr['editID'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID'];
                 $form_creator->popArr['editArr'] = $ejobsp->filterEmpJobSpec($arr);
             } else {
                 $form_creator->popArr['unasscatlist'] = $jdcat->getUnAssJDCatCodes($getArr['id']);
             }
             $form_creator->popArr['rset'] = $ejobsp->getAssEmpJobSpec($getArr['id']);
             //$form_creator ->popArr['catlist']=$ejobsp->getJDCatCodes();
             break;
         case 'CXT':
             $form_creator->formPath = '/templates/hrfunct/hrempconext.php';
             $empconext = new EmpConExt();
             $empinfo = new EmpInfo();
             $form_creator->popArr['empdet'] = $empinfo->filterEmpMain($getArr['id']);
             $form_creator->popArr['empstat'] = $empinfo->filterEmpJobStat($getArr['id']);
             if (isset($getArr['editID'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID'];
                 $form_creator->popArr['editArr'] = $empconext->filterConExt($arr);
                 $form_creator->popArr['lastrec'] = $empconext->getLastRecord($getArr['id']);
             } else {
                 $form_creator->popArr['lastrec'] = $empconext->getLastRecord($getArr['id']);
             }
             $form_creator->popArr['rset'] = $empconext->getAssConExt($getArr['id']);
             break;
         case 'SAL':
             $form_creator->formPath = '/templates/hrfunct/hrempbassal.php';
             $empinfo = new EmpInfo();
             $empbassal = new EmpBasSalary();
             $currTyp = new CurrencyTypes();
             $form_creator->popArr['einfo'] = $empinfo->filterEmpMain($getArr['id']);
             $form_creator->popArr['empdet'] = $empdet = $empinfo->filterEmpJobInfo($getArr['id']);
             $salGrd = $empdet[0][5];
             if (isset($getArr['editID1'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID1'];
                 $arr[2] = $getArr['editID2'];
                 $form_creator->popArr['editArr'] = $edit = $empbassal->filterEmpBasSal($arr);
                 $form_creator->popArr['currlist'] = $empbassal->getCurrCodes($edit[0][1]);
             } else {
                 $form_creator->popArr['curlist'] = $empbassal->getUnAssCurrCodes($salGrd, $getArr['id']);
                 if ($object != null) {
                     $form_creator->popArr['cmbCurrCode'] = $object->cmbCurrCode;
                 }
             }
             $form_creator->popArr['rset'] = $empbassal->getAssEmpBasSal($getArr['id']);
             $form_creator->popArr['currAlllist'] = $currTyp->getAllCurrencyCodes();
             break;
         case 'LAN':
             $form_creator->formPath = '/templates/hrfunct/hremplan.php';
             $empinf = new EmpInfo();
             $emplan = new EmpLanguage();
             $laninfo = new LanguageInfo();
             $form_creator->popArr['empDet'] = $empinf->filterEmpMain($getArr['id']);
             $form_creator->popArr['lanlist'] = $lanlist = $laninfo->getLang();
             if (isset($getArr['editID1'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID1'];
                 $arr[2] = $getArr['editID2'];
                 $form_creator->popArr['editArr'] = $emplan->filterEmpLang($arr);
                 for ($c = 0; count($lanlist) > $c; $c++) {
                     if ($getArr['editID1'] == $lanlist[$c][0]) {
                         $ratSel = $lanlist[$c][2];
                     }
                 }
             } else {
                 if ($object != null) {
                     $form_creator->popArr['cmbLanCode'] = $object->cmbLanCode;
                     for ($c = 0; $lanlist && count($lanlist) > $c; $c++) {
                         if ($lanlist[$c][0] == $object->cmbLanCode) {
                             $ratSel = $lanlist[$c][2];
                         }
                     }
                     $form_creator->popArr['ratSel'] = $ratSel;
                 }
                 $form_creator->popArr['lanlist'] = $laninfo->getLang();
             }
             $form_creator->popArr['rsets'] = $emplan->getAssEmpLang($getArr['id']);
             break;
         case 'MEM':
             $form_creator->formPath = '/templates/hrfunct/hrempmemship.php';
             $empinf = new EmpInfo();
             $empmem = new EmpMembership();
             $memtype = new MembershipType();
             $memshipinfo = new MembershipInfo();
             $form_creator->popArr['empDet'] = $empinf->filterEmpMain($getArr['id']);
             $form_creator->popArr['typlist'] = $typlist = $memtype->getMembershipTypeCodes();
             if (isset($getArr['editID1'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID1'];
                 $arr[2] = $getArr['editID2'];
                 $form_creator->popArr['editArr'] = $edit = $empmem->filterEmpMembership($arr);
                 $form_creator->popArr['mship'] = $memshipinfo->getMembershipCodes($edit[0][2]);
             } else {
                 if ($object != null) {
                     $form_creator->popArr['cmbMemTypeCode'] = $object->cmbMemTypeCode;
                     $form_creator->popArr['mship'] = $memshipinfo->getUnAssMembershipCodes($getArr['id'], $object->cmbMemTypeCode);
                 }
                 $form_creator->popArr['typlist'] = $typlist = $memtype->getMembershipTypeCodes();
             }
             $form_creator->popArr['rset'] = $empmem->getAssEmpMembership($getArr['id']);
             $form_creator->popArr['mshipAll'] = $memshipinfo->getAllMembershipCodes();
             break;
         case 'EXC':
             $form_creator->formPath = '/templates/hrfunct/hrempextcur.php';
             $empinfo = new EmpInfo();
             $empextcur = new EmpExCur();
             $extracurr = new ExtraCurrActCat();
             $extrainfo = new ExtraCurActInfo();
             $form_creator->popArr['empdet'] = $empinfo->filterEmpMain($getArr['id']);
             $form_creator->popArr['catlist'] = $extracurr->getExCurCatCodes();
             if (isset($getArr['editID'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID'];
                 $form_creator->popArr['editArr'] = $edit = $empextcur->filterEmpExCur($arr);
                 $form_creator->popArr['typelist'] = $extrainfo->getExCurTypeCodes($edit[0][2]);
             } else {
                 $form_creator->popArr['lastrec'] = $empextcur->getLastRecord($getArr['id']);
                 if ($object != null) {
                     $form_creator->popArr['cmbExtCurCat'] = $catcode = $object->cmbExtCurCat;
                     $form_creator->popArr['typeunasslist'] = $extrainfo->getUnAssExCurTypeCodes($getArr['id'], $catcode);
                 }
             }
             $form_creator->popArr['rset'] = $empextcur->getAssExCur($getArr['id']);
             $form_creator->popArr['allcatlist'] = $extracurr->getExCurCatCodes();
             $form_creator->popArr['alltypelist'] = $extrainfo->getAllExtraCurActInfo();
             break;
         case 'EXP':
             $form_creator->formPath = '/templates/hrfunct/hrempwrkexp.php';
             $empinfo = new EmpInfo();
             $empworkex = new EmpWorkExp();
             $countryinfo = new CountryInfo();
             $proinfo = new ProvinceInfo();
             $form_creator->popArr['empDet'] = $empinfo->filterEmpMain($getArr['id']);
             if ($object != null) {
                 $form_creator->popArr['txtEmpExpCompany'] = $object->txtEmpExpCompany;
                 $form_creator->popArr['txtEmpExpToDat'] = $object->txtEmpExpToDat;
                 $form_creator->popArr['txtEmpExpDesOnLev'] = $object->txtEmpExpDesOnLev;
                 $form_creator->popArr['txtEmpExpYears'] = $object->txtEmpExpYears;
                 $form_creator->popArr['chkEmpExpWorkRelFlag'] = $object->chkEmpExpWorkRelFlag;
                 $form_creator->popArr['txtEmpExpMonths'] = $object->txtEmpExpMonths;
                 $form_creator->popArr['txtEmpExpAdd1'] = $object->txtEmpExpAdd1;
                 $form_creator->popArr['txtEmpExpAcc'] = $object->txtEmpExpAcc;
                 $form_creator->popArr['txtEmpExpAdd2'] = $object->txtEmpExpAdd2;
             }
             if (isset($getArr['editID'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID'];
                 $form_creator->popArr['editArr'] = $edit = $empworkex->filterEmpWorkExp($arr);
                 $form_creator->popArr['list'] = $countryinfo->getCountryCodes();
                 if ($object != null) {
                     $form_creator->popArr['txtEmpExpAdd2'] = $pli = $object->txtEmpExpAdd2;
                     $form_creator->popArr['txtEmpExpConPers'] = $object->txtEmpExpConPers;
                     $form_creator->popArr['txtEmpExpAdd3'] = $object->txtEmpExpAdd3;
                     $form_creator->popArr['txtEmpExpTelep'] = $object->txtEmpExpTelep;
                     $form_creator->popArr['txtEmpResLev'] = $object->txtEmpResLev;
                     $form_creator->popArr['txtEmpExpAchmnt'] = $object->txtEmpExpAchmnt;
                     $form_creator->popArr['txtEmpExpFromDat'] = $object->txtEmpExpFromDat;
                     $form_creator->popArr['txtEmpExpEmail'] = $object->txtEmpExpEmail;
                     $form_creator->popArr['plist'] = $empinfo->getProvinceCodes($pli);
                 } else {
                     $form_creator->popArr['plist1'] = $proinfo->getProvinceCodes($edit[0][4]);
                 }
             } else {
                 $form_creator->popArr['newID'] = $empworkex->getLastRecord($getArr['id']);
                 $form_creator->popArr['list'] = $countryinfo->getCountryCodes();
                 if ($object != null) {
                     $form_creator->popArr['txtEmpExpCompany'] = $object->txtEmpExpCompany;
                     $form_creator->popArr['txtEmpExpToDat'] = $object->txtEmpExpToDat;
                     $form_creator->popArr['txtEmpExpDesOnLev'] = $object->txtEmpExpDesOnLev;
                     $form_creator->popArr['txtEmpExpYears'] = $object->txtEmpExpYears;
                     $form_creator->popArr['chkEmpExpWorkRelFlag'] = $object->chkEmpExpWorkRelFlag;
                     $form_creator->popArr['txtEmpExpMonths'] = $object->txtEmpExpMonths;
                     $form_creator->popArr['txtEmpExpAdd1'] = $object->txtEmpExpAdd1;
                     $form_creator->popArr['txtEmpExpAcc'] = $object->txtEmpExpAcc;
                     $form_creator->popArr['txtEmpExpTelep'] = $object->txtEmpExpTelep;
                     $form_creator->popArr['txtEmpResLev'] = $object->txtEmpResLev;
                     $form_creator->popArr['txtEmpExpAchmnt'] = $object->txtEmpExpAchmnt;
                     $form_creator->popArr['txtEmpExpFromDat'] = $object->txtEmpExpFromDat;
                     $form_creator->popArr['txtEmpExpEmail'] = $object->txtEmpExpEmail;
                     $form_creator->popArr['txtEmpExpAdd2'] = $plis = $object->txtEmpExpAdd2;
                     $form_creator->popArr['txtEmpExpAdd3'] = $object->txtEmpExpAdd3;
                     $form_creator->popArr['txtEmpExpConPers'] = $object->txtEmpExpConPers;
                     $form_creator->popArr['plist2'] = $empinfo->getProvinceCodes($plis);
                 }
             }
             $form_creator->popArr['rset'] = $empworkex->getAssEmpWorkExp($getArr['id']);
             break;
         case 'QUA':
             $form_creator->formPath = '/templates/hrfunct/hrempqual.php';
             $empinfo = new EmpInfo();
             $empqual = new EmpQualification();
             $qualtyp = new QualificationType();
             $qual = new Qualifications();
             $form_creator->popArr['statlist'] = array('First Class', 'Second Class Upr.', 'Second Class Lwr.');
             $form_creator->popArr['empdet'] = $empinfo->filterEmpMain($getArr['id']);
             $form_creator->popArr['typlist'] = $qualtyp->getQualificationTypeCodes();
             if (isset($getArr['editID'])) {
                 $arr[0] = $getArr['editID'];
                 $arr[1] = $getArr['id'];
                 $form_creator->popArr['editArr'] = $empqual->filterEmpQual($arr);
                 $form_creator->popArr['quallist'] = $qual->getAllQualifications();
             } else {
                 if ($object != null) {
                     $form_creator->popArr['TypeCode'] = $object->TypeCode;
                     $form_creator->popArr['mship'] = $qual->getUnAssQualifications($getArr['id'], $object->TypeCode);
                 }
             }
             $form_creator->popArr['rset'] = $empqual->getAssEmpQual($getArr['id']);
             $form_creator->popArr['allquallist'] = $qual->getAllQualifications();
             break;
         case 'QAS':
             $form_creator->formPath = '/templates/hrfunct/hrempqualsub.php';
             $empinfo = new EmpInfo();
             $qual = new Qualifications();
             $empqualsub = new EmpQualSubject();
             $subinfo = new SubjectInfo();
             $form_creator->popArr['empdet'] = $empinfo->filterEmpMain($getArr['id']);
             $form_creator->popArr['qualDet'] = $qual->filterQualifications($getArr['QUA']);
             $form_creator->popArr['sublistAll'] = $subinfo->getSubjectCodes($getArr['QUA']);
             $form_creator->popArr['ratlist'] = $empqualsub->getRatGrds($getArr['QUA']);
             if (isset($getArr['editID'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['QUA'];
                 $arr[2] = $getArr['editID'];
                 $form_creator->popArr['editArr'] = $empqualsub->filterEmpQualSub($arr);
             } else {
                 $form_creator->popArr['sublistUnAss'] = $subinfo->getUnAssSubjects($getArr['id'], $getArr['QUA']);
             }
             $arr[0] = $getArr['id'];
             $arr[1] = $getArr['QUA'];
             $form_creator->popArr['sublistAss'] = $empqualsub->getAssEmpQualSub($arr);
             break;
         case 'CBN':
             $form_creator->formPath = '/templates/hrfunct/hrempcashben.php';
             $empinfo = new EmpInfo();
             $empcashben = new EmpCashBen();
             $cashben = new CashBen();
             $form_creator->popArr['empdet'] = $empinfo->filterEmpMain($getArr['id']);
             $form_creator->popArr['bfilter'] = array('Salary Point' => 1, 'Designation' => 2, 'Employee' => 3);
             $form_creator->popArr['benlist'] = $cashben->getBenCodes();
             if (isset($getArr['editID'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID'];
                 $form_creator->popArr['editArr'] = $empcashben->filterEmpCashBen($arr);
             }
             $form_creator->popArr['cashbenAss'] = $empcashben->getAssEmpCashBen($getArr['id']);
             $form_creator->popArr['cashbenUnAss'] = $empcashben->getUnAssEmpCashBen($getArr['id']);
             if (isset($getArr['OBEN'])) {
                 $form_creator->popArr['cashbenOther'] = $cashben->getOthEmpCashBen($getArr['id']);
             }
             break;
         case 'NBN':
             $form_creator->formPath = '/templates/hrfunct/hrempnoncashben.php';
             $empinfo = new EmpInfo();
             $empnoncashben = new EmpNonCashBen();
             $noncashben = new NonCashBen();
             $form_creator->popArr['empdet'] = $empinfo->filterEmpMain($getArr['id']);
             $form_creator->popArr['bfilter'] = array('Salary Point' => 1, 'Designation' => 2, 'Employee' => 3);
             $form_creator->popArr['benlist'] = $noncashben->getBenCodes();
             if (isset($getArr['editID'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID'];
                 $form_creator->popArr['editArr'] = $empnoncashben->filterEmpNonCashBen($arr);
             }
             $form_creator->popArr['cashbenAss'] = $empnoncashben->getAssEmpNonCashBen($getArr['id']);
             $form_creator->popArr['cashbenUnAss'] = $empnoncashben->getUnAssEmpNonCashBen($getArr['id']);
             if (isset($getArr['OBEN'])) {
                 $form_creator->popArr['cashbenOther'] = $noncashben->getOthEmpNonCashBen($getArr['id']);
             }
             break;
         case 'ESS':
         case 'EMP':
             $form_creator->formPath = '/templates/hrfunct/hrEmpMain.php';
             //hremp.php';
             $form_creator->popArr['arrMStat'] = array('Unmarried', 'Married', 'Divorced', 'Others');
             $empinfo = new EmpInfo();
             $pport = new EmpPassPort();
             $ddebit = new EmpDirectDebit();
             $dep = new EmpDependents();
             $econ = new EmpEmergencyCon();
             $chi = new EmpChildren();
             $attachment = new EmpAttach();
             $countryinfo = new CountryInfo();
             $porinfo = new ProvinceInfo();
             $nationinfo = new NationalityInfo();
             $location = new models_eimadmin_Location();
             $distric = new DistrictInfo();
             $jobtit = new JobTitle();
             $depen = new EmpDependents();
             $ethnicrace = new EthnicRace();
             $eeojobcat = new EEOJobCat();
             $emplan = new EmpLanguage();
             $laninfo = new LanguageInfo();
             $emplicen = new EmpLicenses();
             $licen = new Licenses();
             $empmem = new EmpMembership();
             $memtype = new MembershipType();
             $memshipinfo = new MembershipInfo();
             $emprepto = new EmpRepTo();
             $empskill = new EmpSkill();
             $skill = new Skills();
             $empworkex = new EmpWorkExp();
             $empeducation = new EmpEducation();
             $education = new Education();
             $empTax = new EmpTax();
             $form_creator->popArr['nation'] = $nationinfo->getNationCodes();
             $form_creator->popArr['loc'] = $location->getLocCodes();
             $form_creator->popArr['cntlist'] = $countryinfo->getCountryCodes();
             $form_creator->popArr['ethRace'] = $ethnicrace->getEthnicRaceCodes();
             $form_creator->popArr['eeojobcat'] = $eeojobcat->getEEOJobCatCodes();
             $form_creator->popArr['jobtit'] = $jobtit->getJobTit();
             $form_creator->popArr['hier'] = isset($res) ? $res : false;
             $form_creator->popArr['cntlist'] = $countrylist = $countryinfo->getCountryCodes();
             $form_creator->popArr['ppcntlist'] = $countrylist;
             $form_creator->popArr['customFieldList'] = CustomFields::getCustomFieldList();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $empinfo->getLastId();
                 if ($object != null) {
                     $form_creator->popArr['ctlist'] = $corptit->getCorpTitlesEmpInfo($object->cmbSalGrd);
                     $form_creator->popArr['deslist'] = $des->getDesEmpInfo($object->cmbCorpTit);
                     $form_creator->popArr['plist'] = $porinfo->getProvinceCodes($object->cmbTaxCountry);
                     $form_creator->popArr['resplist'] = $porinfo->getProvinceCodes($object->cmbPermCountry);
                     $form_creator->popArr['resdlist'] = $distric->getDistrictCodes($object->cmbPermProvince);
                     if (isset($postArr['cmbJobTitle'])) {
                         $form_creator->popArr['empstatlist'] = $view_controller->xajaxObjCall($postArr['cmbJobTitle'], 'JOB', 'allEmpStat');
                     }
                     $form_creator->popArr['ethRace'] = $ethnicrace->getEthnicRaceCodes($object->cmbEthnicRace);
                 }
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editTaxInfo'] = $empTax->getEmployeeTaxInfo($getArr['id']);
                 $form_creator->popArr['usStateList'] = $porinfo->getProvinceCodes('US');
                 $form_creator->popArr['empDDAss'] = $ddebit->getEmployeeDirectDebit($getArr['id']);
                 if (isset($getArr['DDSEQ'])) {
                     $form_creator->popArr['editDDForm'] = $ddebit->getDirectDebit($getArr['id'], $getArr['DDSEQ']);
                 }
                 $form_creator->popArr['editMainArr'] = $empinfo->filterEmpMain($getArr['id']);
                 $form_creator->popArr['editPersArr'] = $empinfo->filterEmpPers($getArr['id']);
                 $form_creator->popArr['editJobInfoArr'] = $empJobInfo = $empinfo->filterEmpJobInfo($getArr['id']);
                 $form_creator->popArr['editCustomInfoArr'] = $empCustomInfo = $empinfo->filterEmpCustomInfo($getArr['id']);
                 $view_controller = new ViewController();
                 $form_creator->popArr['empstatlist'] = $view_controller->xajaxObjCall($empJobInfo[0][2], 'JOB', 'allEmpStat');
                 $empJobTitle = $empJobInfo[0][2];
                 if (isset($postArr['cmbJobTitle'])) {
                     $form_creator->popArr['empstatlist'] = $view_controller->xajaxObjCall($postArr['cmbJobTitle'], 'JOB', 'allEmpStat');
                     $empJobTitle = $postArr['cmbJobTitle'];
                 }
                 if (CommonFunctions::isValidId($empJobTitle, 'JOB')) {
                     $empJobSpec = $view_controller->getJobSpecForJob($empJobTitle);
                 } else {
                     $empJobSpec = null;
                 }
                 $form_creator->popArr['jobSpec'] = $empJobSpec;
                 $jobTitleHistory = new JobTitleHistory();
                 $form_creator->popArr['jobTitleHistory'] = $jobTitleHistory->getHistory($getArr['id']);
                 $empDivisionHistory = new SubDivisionHistory();
                 $form_creator->popArr['subDivisionHistory'] = $empDivisionHistory->getHistory($getArr['id']);
                 $locationHistory = new LocationHistory();
                 $form_creator->popArr['locationHistory'] = $locationHistory->getHistory($getArr['id']);
                 $form_creator->popArr['assignedlocationList'] = EmpLocation::getEmpLocations($getArr['id']);
                 $form_creator->popArr['availablelocationList'] = EmpLocation::getUnassignedLocations($getArr['id']);
                 $form_creator->popArr['editPermResArr'] = $edit = $editPermRes = $empinfo->filterEmpContact($getArr['id']);
                 $form_creator->popArr['provlist'] = $porinfo->getProvinceCodes($edit[0][4]);
                 $form_creator->popArr['citylist'] = $distric->getDistrictCodes($edit[0][5]);
                 $form_creator->popArr['empPPAss'] = $pport->getAssEmpPP($getArr['id']);
                 $form_creator->popArr['empDepAss'] = $dep->getAssEmpDep($getArr['id']);
                 $form_creator->popArr['empECAss'] = $econ->getAssEmpEC($getArr['id']);
                 $form_creator->popArr['empChiAss'] = $chi->getAssEmpChi($getArr['id']);
                 $form_creator->popArr['empAttAss'] = $attachment->getAssEmpAtt($getArr['id']);
                 $form_creator->popArr['empDpAss'] = $depen->getAssEmpDep($getArr['id']);
                 $form_creator->popArr['newPPID'] = $pport->getLastRecord($getArr['id']);
                 if (isset($getArr['PPSEQ'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['PPSEQ'];
                     $form_creator->popArr['editPPForm'] = $pport->filterEmpPP($arr);
                 }
                 $form_creator->popArr['newECID'] = $econ->getLastRecord($getArr['id']);
                 if (isset($getArr['ECSEQ'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['ECSEQ'];
                     $form_creator->popArr['editECForm'] = $econ->filterEmpEC($arr);
                 }
                 $form_creator->popArr['newDepID'] = $dep->getLastRecord($getArr['id']);
                 if (isset($getArr['depSEQ'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['depSEQ'];
                     $form_creator->popArr['editDepForm'] = $dep->filterEmpDep($arr);
                 }
                 $form_creator->popArr['newCID'] = $chi->getLastRecord($getArr['id']);
                 if (isset($getArr['CHSEQ'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['CHSEQ'];
                     $form_creator->popArr['editChiForm'] = $chi->filterEmpChi($arr);
                 }
                 if (isset($getArr['ATTACH'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['ATTACH'];
                     $form_creator->popArr['editAttForm'] = $attachment->filterEmpAtt($arr);
                 }
                 $form_creator->popArr['lantype'] = array('Writing' => 1, 'Speaking' => 2, 'Reading' => 3);
                 $form_creator->popArr['grdcodes'] = array('Poor' => 1, 'Basic' => 2, 'Good' => 3, 'Mother Tongue' => 4);
                 $form_creator->popArr['lanlist'] = $lanlist = $laninfo->getLang();
                 if (isset($getArr['lanSEQ'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['lanSEQ'];
                     $arr[2] = $getArr['lanFLU'];
                     $form_creator->popArr['editLanArr'] = $emplan->filterEmpLang($arr);
                 }
                 $form_creator->popArr['rsetLang'] = $emplan->getAssEmpLang($getArr['id']);
                 $form_creator->popArr['allLicenlist'] = $licenlist = $licen->getLicensesCodes();
                 $form_creator->popArr['unassLicenlist'] = $licen->getUnAssLicensesCodes($getArr['id']);
                 if (isset($getArr['LIC'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['LIC'];
                     $form_creator->popArr['editLicenseArr'] = $emplicen->filterEmpLicenses($arr);
                 }
                 $form_creator->popArr['rsetLicense'] = $emplicen->getAssEmpLicenses($getArr['id']);
                 $form_creator->popArr['typlist'] = $typlist = $memtype->getMembershipTypeCodes();
                 if (isset($getArr['MEM'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['MEM'];
                     $arr[2] = $getArr['MTP'];
                     $form_creator->popArr['editMembershipArr'] = $edit = $empmem->filterEmpMembership($arr);
                     $form_creator->popArr['mship'] = $memshipinfo->getMembershipCodes($edit[0][2]);
                 }
                 $form_creator->popArr['rsetMembership'] = $empmem->getAssEmpMembership($getArr['id']);
                 $form_creator->popArr['mshipAll'] = $memshipinfo->getAllMembershipCodes();
                 $empbassal = new EmpBasSalary();
                 $currTyp = new CurrencyTypes();
                 $jobtit = new JobTitle();
                 $salgradelist = new SalaryGrades();
                 $form_creator->popArr['salgradelist'] = $salgradelist->getSalGrades(true);
                 $empdet = $empinfo->filterEmpJobInfo($getArr['id']);
                 $jt = $jobtit->filterJobTitles($empdet[0][2]);
                 $form_creator->popArr['payPeriodList'] = PayPeriod::getPayPeriodList();
                 $form_creator->popArr['salGrd'] = $salGrd = $empbassal->getEmpSalGrade($getArr['id']);
                 if (isset($getArr['PAY'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['PAY'];
                     $arr[2] = $getArr['CUR'];
                     $form_creator->popArr['editPaymentArr'] = $edit = $empbassal->filterEmpBasSal($arr);
                     $form_creator->popArr['salGrd'] = $salGrd = $edit[0][1];
                     $form_creator->popArr['currlist'] = $empbassal->getCurrCodes($edit[0][1]);
                 }
                 $form_creator->popArr['unAssCurrList'] = $empbassal->getUnAssCurrCodes($salGrd, $getArr['id']);
                 $form_creator->popArr['rsetPayment'] = $empbassal->getAssEmpBasSal($getArr['id']);
                 $form_creator->popArr['currAlllist'] = $currTyp->getAllCurrencyCodes();
                 $form_creator->popArr['suprset'] = $emprepto->getEmpSup($getArr['id']);
                 $form_creator->popArr['empname'] = $empinfo->getEmpInfo();
                 $form_creator->popArr['subrset'] = $emprepto->getEmpSub($getArr['id']);
                 if (isset($getArr['editIDSup'])) {
                     $arr[0] = $getArr['editIDSup'];
                     $arr[1] = $getArr['id'];
                     $arr[2] = $getArr['RepMethod'];
                     $form_creator->popArr['editIDSupInfo'] = $emprepto->filterEmpRepTo($arr);
                 }
                 if (isset($getArr['editIDSub'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['editIDSub'];
                     $arr[2] = $getArr['RepMethod'];
                     $form_creator->popArr['editIDSubInfo'] = $emprepto->filterEmpRepTo($arr);
                 }
                 $form_creator->popArr['allSkilllist'] = $skill->getSkillCodes();
                 $form_creator->popArr['uskilllist'] = $skill->getUnAssSkillCodes($getArr['id']);
                 if (isset($getArr['SKILL'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['SKILL'];
                     $form_creator->popArr['editSkillArr'] = $empskill->filterEmpSkill($arr);
                 }
                 $form_creator->popArr['rsetSkill'] = $empskill->getAssEmpSkill($getArr['id']);
                 $form_creator->popArr['newWrkExpID'] = $empworkex->getLastRecord($getArr['id']);
                 if (isset($getArr['WRKEXP'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['WRKEXP'];
                     $form_creator->popArr['editWrkExpArr'] = $edit = $empworkex->filterEmpWorkExp($arr);
                 }
                 $form_creator->popArr['rsetWrkExp'] = $empworkex->getAssEmpWorkExp($getArr['id']);
                 $form_creator->popArr['allEduCodes'] = $education->getListofEducation(0, '', 0);
                 $form_creator->popArr['unAssEduCodes'] = $empeducation->getUnAssEduCodes($getArr['id']);
                 if (isset($getArr['EDU'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['EDU'];
                     $form_creator->popArr['editEducationArr'] = $empeducation->filterEmpEducation($arr);
                 }
                 $form_creator->popArr['rsetEducation'] = $empeducation->getAssEmpEducation($getArr['id']);
                 if ($object != null) {
                     $form_creator->popArr['ctlist'] = $corptit->getCorpTitlesEmpInfo($object->cmbSalGrd);
                     $form_creator->popArr['deslist'] = $des->getDesEmpInfo($object->cmbCorpTit);
                     $form_creator->popArr['resplist'] = $porinfo->getProvinceCodes($object->cmbPermCountry);
                     $form_creator->popArr['resdlist'] = $distric->getDistrictCodes($object->cmbPermProvince);
                     $form_creator->popArr['brchlist'] = $brch->getUnAssBranchCodes($getArr['id'], $object->cmbBank);
                     $form_creator->popArr['ctlist'] = $empinfo->getCorpTitles($object->cmbSalGrd);
                     $form_creator->popArr['deslist'] = $empinfo->getDes($object->cmbCorpTit);
                     $form_creator->popArr['resplist'] = $empinfo->getProvinceCodes($object->cmbPermCountry);
                     $form_creator->popArr['resdlist'] = $empinfo->getDistrictCodes($object->cmbPermProvince);
                     $form_creator->popArr['brchlist'] = $brch->getUnAssBranchCodes($getArr['id'], $object->cmbBank);
                 } else {
                     $form_creator->popArr['resplist'] = $porinfo->getProvinceCodes($editPermRes[0][10]);
                     $form_creator->popArr['resdlist'] = $distric->getDistrictCodes($editPermRes[0][11]);
                 }
                 $empconext = new EmpConExt();
                 $form_creator->popArr['newConExtID'] = $empconext->getLastRecord($getArr['id']);
                 if (isset($getArr['CONEXT'])) {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['CONEXT'];
                     $form_creator->popArr['editConExtArr'] = $empconext->filterConExt($arr);
                 }
                 $form_creator->popArr['rsetConExt'] = $empconext->getAssConExt($getArr['id']);
             }
             break;
         case 'REP':
             $form_creator->formPath = '/templates/hrfunct/hremprepto.php';
             $empinfo = new EmpInfo();
             $emprepto = new EmpRepTo();
             $form_creator->popArr['empdet'] = $empinfo->filterEmpMain($getArr['id']);
             $form_creator->popArr['suprset'] = $emprepto->getEmpSup($getArr['id']);
             $form_creator->popArr['empname'] = $empinfo->getEmpInfo();
             $form_creator->popArr['subrset'] = $emprepto->getEmpSub($getArr['id']);
             if (isset($getArr['editIDSup'])) {
                 $arr[0] = $getArr['editIDSup'];
                 $arr[1] = $getArr['id'];
                 $arr[2] = $getArr['repmethod'];
                 $form_creator->popArr['editIDSupInfo'] = $emprepto->filterEmpRepTo($arr);
             }
             if (isset($getArr['editIDSub'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editIDSub'];
                 $arr[2] = $getArr['repmethod'];
                 $form_creator->popArr['editIDSubInfo'] = $emprepto->filterEmpRepTo($arr);
             }
             break;
         case 'SKI':
             $form_creator->formPath = '/templates/hrfunct/hrempskill.php';
             $empinf = new EmpInfo();
             $empskill = new EmpSkill();
             $skill = new Skills();
             $form_creator->popArr['empDet'] = $empinf->filterEmpMain($getArr['id']);
             $form_creator->popArr['allSkilllist'] = $skill->getSkillCodes();
             if (isset($getArr['editID1'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID1'];
                 $arr[2] = $getArr['editID2'];
                 $form_creator->popArr['editArr'] = $empskill->filterEmpSkill($arr);
             } else {
                 $form_creator->popArr['uskilllist'] = $skill->getUnAssSkillCodes($getArr['id']);
             }
             $form_creator->popArr['rsets'] = $empskill->getAssEmpSkill($getArr['id']);
             break;
         case 'LIC':
             $form_creator->formPath = '/templates/hrfunct/hremplicenses.php';
             $empinf = new EmpInfo();
             $emplicen = new EmpLicenses();
             $licen = new Licenses();
             $form_creator->popArr['empDet'] = $empinf->filterEmpMain($getArr['id']);
             $form_creator->popArr['allLicenlist'] = $licenlist = $licen->getLicensesCodes();
             $form_creator->popArr['unassLicenlist'] = $licen->getUnAssLicensesCodes($getArr['id']);
             if (isset($getArr['editID1'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID1'];
                 $arr[2] = $getArr['editID2'];
                 $form_creator->popArr['editArr'] = $emplicen->filterEmpLicenses($arr);
             }
             $form_creator->popArr['rsets'] = $emplicen->getAssEmpLicenses($getArr['id']);
             break;
     }
     $form_creator->display();
 }
Example #12
0
                // Show all posts
            }
        }
    }
    // Determine the appropriate content for public viewing
    public function public_display()
    {
        if (isset($_GET['register'])) {
            // Registration Page
            return 'views/register.php';
        } else {
            if (isset($_GET['login'])) {
                // Login Page
                return 'views/login.php';
            } else {
                return 'views/main.php';
                // Public view of posts
            }
        }
    }
}
$view_controller = new ViewController();
// Initialize View Controller
// Different content for public viewers / registered users
if (isset($_SESSION['username'])) {
    // Registered
    require_once $view_controller->user_display();
} else {
    // Public
    require_once $view_controller->public_display();
}
Example #13
0
<?php

session_start();
include 'ViewController.class.php';
$control = new ViewController();
$email = "";
$password = "";
$info = "&nbsp;";
if (isset($_SESSION['auth'])) {
    // Existing User who is Already SignedIn
    header("location: ../dashboard/");
    exit;
}
if (isset($_POST['login'])) {
    $email = trim($_POST['email']);
    $password = trim($_POST['password']);
    if ($control->register($email, $password)) {
        $info = $info . 'Signup Successful. Please proceed to Login <a href="../signin/"> here</a>';
        $registered = true;
    } else {
        $info = $info . $control->info;
    }
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head>
	<title>Singup!</title>
	<link href="style.css" rel="stylesheet"/>
</head>
Example #14
0
 public function indexAction()
 {
     $db = Zend_Registry::get('db');
     $langCode = $this->_sesija->lang;
     //$langCode = "sr";
     $values = $this->_request->getParams();
     if (@$values['page'] == "" && (!isset($values['what']) || $values['what'] == "")) {
         //die("No search string!");
         $content = $this->_translate->_("No search string!");
         //$template = $db->fetchAll("SELECT output FROM templates_$langCode where defaultTemplate = '1'");
         $template = $db->fetchAll("SELECT output, bodyBg FROM templates_{$langCode} RIGHT JOIN modules ON modules.templateId = templates_{$langCode}.id ");
         if (!empty($template)) {
             $out = ViewController::_templatePrepare($template[0]['output'], $content);
             $this->view->output = $out;
             $this->view->templateBodyBackground = $template[0]['bodyBg'];
         }
         return;
     }
     $what = $values['what'];
     // This cache doesn't expire, needs to be cleaned manually.
     $frontendOptions = array('caching' => true, 'lifetime' => null, 'ignore_user_abort' => true, 'automatic_serialization' => true);
     $backendOptions = array('cache_dir' => NET_PATH . 'searchIndex/');
     $cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
     Zend_Registry::set('pagesAll_' . $langCode, $cache);
     //ACL
     $acl = Zend_Registry::get('acl');
     $curRole = Zend_Registry::get('currentRole');
     $allowArray = Zend_Registry::get('aclAllow');
     if (!($results = $cache->load('pagesAll_' . $langCode))) {
         $pages = $db->fetchAll("SELECT output, title, alias, id, check_access FROM pages_{$langCode} WHERE published = '1'");
         $cache->save($pages, 'pagesAll_' . $langCode);
     } else {
         $pages = $results;
     }
     //print_r($pages);
     $i = 0;
     foreach ($pages as $page) {
         if ($page['check_access'] == '1') {
             //ACL in relation to page
             if (!$acl->has('page:' . $page['id'])) {
                 $acl->add(new Zend_Acl_Resource('page:' . $page['id']));
                 //make sure resource exists
             }
             if (@in_array('page:' . $page['id'], $allowArray[$curRole])) {
                 $acl->allow($curRole, 'page:' . $page['id']);
                 //allow resource access if it is in allow array
             }
             if (!$acl->isAllowed($curRole, 'page:' . $page['id'])) {
                 // no permission, move along now
                 continue;
             }
         }
         //ACL END
         //load page from search index if it is there
         if (!($resultsSearch = $cache->load('page' . $page['id'] . "_" . $langCode . "_" . $curRole))) {
             $out = ViewController::_templatePrepare($page['output']);
             //compile output
             $cache->save($out, 'page' . $page['id'] . "_" . $langCode . "_" . $curRole);
             //save to search index
         } else {
             $out = $resultsSearch;
             //it is in index , use it
         }
         //echo $what;
         if (preg_match("/{$what}/i", strip_tags($out))) {
             @($pos = stripos(strip_tags($out), $what));
             //if (preg_match("/$what/i",strip_tags($page['title']) )  ) {
             //   $hits[$i]['title'] =  '<b class="searchHitsBG"><i>' . $page['title'] . "</i></b>";
             //} else {
             $hits[$i]['title'] = $page['title'];
             //}
             $lengthOfWhat = strlen($what);
             $hits[$i]['teaser'] = '...<b class="searchHitsBG"><i>' . substr(strip_tags($out), $pos, $lengthOfWhat) . "</i></b>" . substr(strip_tags($out), $pos + $lengthOfWhat, 350) . "...";
             $hits[$i]['url'] = "pages/" . $page['id'];
             $hits[$i]['url'] = $page['alias'] . ".html";
         }
         if (preg_match("/{$what}/i", strip_tags($page['title']))) {
             @($pos = stripos(strip_tags($page['title']), $what));
             $lengthOfWhat = strlen($what);
             $hits[$i]['title'] = substr(strip_tags($page['title']), 0, $pos) . '<b class="searchHitsBG"><i>' . substr(strip_tags($page['title']), $pos, $lengthOfWhat) . "</i></b>" . substr(strip_tags($page['title']), $pos + $lengthOfWhat, 150);
             $hits[$i]['teaser'] = "..." . substr(strip_tags($out), 0, 350) . "...";
             $hits[$i]['url'] = "pages/" . $page['id'];
             $hits[$i]['url'] = $page['alias'] . ".html";
         }
         $i++;
     }
     if (isset($hits)) {
         $content = $this->_renderSearch(@$hits, $what);
     } else {
         $content = "<h3>" . $this->_translate->_("No results for ") . '"' . $what . '"!</h3>';
     }
     //$template = $db->fetchAll("SELECT output FROM templates_$langCode where defaultTemplate = '1'");
     $template = $db->fetchAll("SELECT output, bodyBg FROM templates_{$langCode} RIGHT JOIN modules ON modules.templateId = templates_{$langCode}.id ");
     if (!empty($template)) {
         $out = ViewController::_templatePrepare($template[0]['output'], $content);
         $this->view->output = ViewController::_liveBlocksPrepare($out);
         $this->view->templateBodyBackground = $template[0]['bodyBg'];
     }
 }
Example #15
0
 public function testGetViewScript()
 {
     $request = new Zend_Controller_Request_Http();
     $request->setControllerName('view')->setActionName('test');
     $response = new Zend_Controller_Response_Cli();
     Zend_Controller_Front::getInstance()->setControllerDirectory(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files');
     require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'ViewController.php';
     $controller = new ViewController($request, $response);
     $script = $controller->getViewScript();
     $this->assertContains('view' . DIRECTORY_SEPARATOR . 'test.phtml', $script);
     $script = $controller->getViewScript('foo');
     $this->assertContains('view' . DIRECTORY_SEPARATOR . 'foo.phtml', $script);
 }
 */
if ($_SESSION['isSupervisor'] && $moduletype == 'admin' && $_GET['uniqcode'] == 'TCP') {
    $locRights = array('add' => true, 'edit' => true, 'delete' => true, 'view' => true);
}
$ugroup = new UserGroups();
$ugDet = $ugroup->filterUserGroups($_SESSION['userGroup']);
$locRights['repDef'] = $ugDet !== null && $ugDet[0][2] == '1' ? true : false;
$_SESSION['localRights'] = $locRights;
switch ($moduletype) {
    case 'admin':
        // beg. admin module
        $authorizeObj = new authorize($_SESSION['empID'], $_SESSION['isAdmin']);
        if (!$authorizeObj->isActionPermitted($_GET['uniqcode'])) {
            die('Your are not authorize to view this page');
        }
        $view_controller = new ViewController();
        if (isset($_POST['delState']) && $_POST['delState'] == 'DeleteMode' && $locRights['delete']) {
            $arrList[0] = $_POST['chkLocID'];
            $view_controller->delParser(trim($_GET['uniqcode']), $arrList);
        }
        if (isset($_GET['VIEW']) && $_GET['VIEW'] == 'MAIN' && $locRights['view']) {
            $view_controller->viewList($_GET, $_POST);
            break;
        }
        // choosing which extractor
        switch ($_GET['uniqcode']) {
            case 'GEN':
                if (isset($_POST['STAT'])) {
                    $extractor = new EXTRACTOR_GenInfo();
                }
                break;
Example #17
0
 public function indexAction()
 {
     $this->_sesija = new Zend_Session_Namespace('net');
     $this->checkApplication();
     //check if update of the encoded files is needed
     $db = Zend_Registry::get('db');
     //$this->changeLang("sr");
     $langCode = $this->_sesija->lang;
     $values = $this->_request->getParams();
     $commentsAuto = Zend_Registry::get('commentsAuto');
     //should comments be auto added to each page
     $resID = $db->fetchAll("SELECT id, check_access FROM pages_{$langCode}  WHERE homepage = '1' ");
     //get which is the home page
     if (empty($resID)) {
         $this->_helper->layout->setLayoutPath(NET_PATH . 'layouts/scripts/errorPages')->setLayout('underConstruction');
         return;
     }
     @($id = $resID[0]['id']);
     $translator = $this->translator;
     if (!($result = $this->_cache->load("q_View_index_{$langCode}" . "_{$id}"))) {
         //caching this query
         //do required queries for the page and template
         $res = $db->fetchAll("SELECT output, title, description, keywords, template_id, published, unbounded FROM pages_{$langCode}  WHERE id = ?", array($id));
         $resTemplate = $db->fetchAll("SELECT output, bodyBg FROM templates_{$langCode} WHERE id = ?", array($res[0]['template_id']));
         $cachedresult = array('res' => $res, 'resTemplate' => $resTemplate);
         $this->_cache->save($cachedresult, "q_View_index_{$langCode}" . "_{$id}");
     } else {
         $res = $result['res'];
         $resTemplate = $result['resTemplate'];
     }
     //if {html:} then turn the htmlawed off
     $mystring = $res[0]['output'];
     $mystring2 = @$resTemplate[0]['output'];
     $findme = '{html:';
     $pos = strpos($mystring, $findme);
     $pos2 = strpos($mystring2, $findme);
     if ($pos === false && $pos2 === false) {
         $htmlawedFeature = 1;
     } else {
         $htmlawedFeature = 0;
     }
     //$this->view->templateBodyBackground = "url(" . $this->_host . "images/templates/" . $res[0]['template_id'] . "/bodyBg.jpg)";
     $this->view->templateBodyBackground = @$resTemplate[0]['bodyBg'];
     $bodyBG = @$resTemplate[0]['bodyBg'];
     $this->view->bg = @$resTemplate[0]['bodyBg'];
     require_once NET_PATH . 'includes/htmLawed/htmLawed.php';
     //require htmlLawed
     $config = array('comments' => 0, 'cdata' => 0, 'lc_std_val' => 0, 'deny_attribute' => 'on*', 'schemes' => 'classid:clsid; href: aim, feed, file, ftp, gopher, http, https, irc, mailto,skype , news, nntp, sftp, ssh, telnet; style: *; *:file, http, https');
     //config for htmLawed
     //ACL
     $acl = Zend_Registry::get('acl');
     $curRole = Zend_Registry::get('currentRole');
     $allowArray = Zend_Registry::get('aclAllow');
     if ($resID[0]['check_access'] == '1') {
         //ACL in relation to page
         if (!$acl->has('page:' . $resID[0]['id'])) {
             $acl->add(new Zend_Acl_Resource('page:' . $resID[0]['id']));
             //make sure resource exists
         }
         if (@in_array('page:' . $resID[0]['id'], $allowArray[$curRole])) {
             $acl->allow($curRole, 'page:' . $resID[0]['id']);
             //allow resource access if it is in allow array
         }
         if (!$acl->isAllowed($curRole, 'page:' . $resID[0]['id'])) {
             // no permission, move along now
             $output = $translator->_("<b><h2>You dont have permission to access this content!</h2></b>");
             $outputTemplate = ViewController::_templatePrepare($resTemplate[0]['output'], $output);
             $out = ViewController::_liveBlocksPrepare($outputTemplate);
             //if htmlawed
             if ($htmlawedFeature == 1) {
                 $this->view->output = htmLawed($out, $config);
             } else {
                 $this->view->output = $out;
             }
             return;
         }
     }
     //ACL END
     //if ($alias != '' ) {
     //    Zend_Registry::set('page' . utf8_encode($alias), $cache);
     //} else {
     Zend_Registry::set('page' . $id . "_" . $langCode, $this->_cache);
     $this->_sesija->_urlCurrent = $this->_host . "pages/" . $id;
     //self::$urlCurrent = $this->_sesija->_urlCurrent;
     // }
     //if there is a page cached, load it
     if (!($results = $this->_cache->load('page' . $id . "_" . $langCode . "_" . $this->_sesija->currentRole))) {
         if (!$res || $res[0]['published'] != '1') {
             Zend_Registry::set('pageTitle', "404");
             $outputDB = '<b>404</b>';
             $outputDBtemplate = '';
             $title = '404';
             $meta_description = '404';
             $meta_keywords = '404';
             $this->_helper->layout->setLayoutPath(NET_PATH . 'layouts/scripts/errorPages')->setLayout('404');
             return;
         } else {
             Zend_Registry::set('pageTitle', $res[0]['title']);
             $outputDB = $res[0]['output'];
             $outputDBtemplate = @$resTemplate[0]['output'];
             $title = $res[0]['title'];
             $meta_description = $res[0]['description'];
             $meta_keywords = $res[0]['keywords'];
             //if description empty input default description
             if ($meta_description == "") {
                 $defDecr = Zend_Registry::get('defaultDescription');
                 $meta_description = $defDecr;
             }
             //if keywords empty input default keywords
             if ($meta_keywords == "") {
                 $defKW = Zend_Registry::get('defaultKeywords');
                 $meta_keywords = $defKW;
             }
         }
         $comments = '<div id="commentsDivWrapper" style="">{liveblock:comments:display:' . $id . '}</div>';
         $output = ViewController::_templatePrepare($outputDB);
         if ($commentsAuto == "1") {
             $output = str_replace('{liveblock:comments:display:' . $id . '}', '', $output);
             //if there is defined auto display of the comments, remove manually entered ones
         }
         if ($res[0]['unbounded'] == '0') {
             //position in content
             $this->_insideContentArea = true;
         } else {
             //absolute position
             $this->_insideContentArea = false;
             $comments = '<div id="commentsDivWrapper" style="position:absolute;display:none;">{liveblock:comments:display:' . $id . '}</div>';
             //comments disabled if absolute positioning for now
             //$comments = '';
         }
         //if automatic comments display is set to 0, dont display comments
         if ($commentsAuto == "0") {
             $comments = '';
         } else {
             //str_replace('{liveblock:comments:display:' . $id . '}', '', $output);//if there is defined auto display of the comments, remove manually entered ones
         }
         $_insideContentArea = $this->_insideContentArea;
         //if not supposed to be absolute positioning
         if ($_insideContentArea == true) {
             //handling the output for the content area
             $output = str_replace("position: absolute;", "position: absolute;", $output);
             //$output = str_replace('<div id="templateMask"/>', "" , $output);
             $output = '<div id="contentDivWrapper" style="position:relative;">' . $output . "</div><br /><br />";
             $outputTemplate = ViewController::_templatePrepare($outputDBtemplate, $output . $comments);
             $out = ViewController::_liveBlocksPrepare($outputTemplate);
             //if htmlawed
             if ($htmlawedFeature == 1) {
                 $this->view->output = htmLawed($out, $config);
             } else {
                 $this->view->output = $out;
             }
             //$this->view->output = htmLawed($out, $config) ;
             $cachedOutput = $outputTemplate;
         } else {
             $outputTemplate = ViewController::_templatePrepare($outputDBtemplate);
             $output = '<div class="contentArea">' . $output . "</div>";
             $out = ViewController::_liveBlocksPrepare($outputTemplate . $output . $comments);
             //if htmlawed
             if ($htmlawedFeature == 1) {
                 $this->view->output = htmLawed($out, $config);
             } else {
                 $this->view->output = $out;
             }
             //$this->view->output = htmLawed($out, $config );
             $cachedOutput = $outputTemplate . $output . $comments;
         }
         $this->view->translate = $translator;
         $this->view->title = $title;
         $this->view->meta_description = $meta_description;
         $this->view->meta_keywords = $meta_keywords;
         $cacheResult = array('output' => $cachedOutput, 'title' => $title, 'metaDesc' => $meta_description, 'metaKeywords' => $meta_keywords);
         $cacheEnabled = $this->_cacheEnabled;
         if ($cacheEnabled == 1) {
             $this->_cache->save($cacheResult, 'page' . $id . "_" . $langCode . "_" . $this->_sesija->currentRole);
         }
     } else {
         //display page from cache
         //if htmlawed
         if ($htmlawedFeature == 1) {
             $this->view->output = htmLawed(ViewController::_liveBlocksPrepare($results['output']), $config);
         } else {
             $this->view->output = ViewController::_liveBlocksPrepare($results['output']);
         }
         //$this->view->output = htmLawed(ViewController::_liveBlocksPrepare($results['output'] ), $config);
         $this->view->title = $results['title'];
         $this->view->meta_description = $results['metaDesc'];
         $this->view->meta_keywords = $results['metaKeywords'];
         $this->view->translate = $translator;
     }
 }
Example #18
0
 function __construct()
 {
     $this->app = \StarterKit\App::getInstance();
     parent::__construct();
 }
Example #19
0
<?php

session_start();
include 'ViewController.class.php';
$control = new ViewController();
$email = "";
$password = "";
$info = "&nbsp;";
if (isset($_SESSION['auth'])) {
    // Existing User who is Already SignedIn
    header("location: ../dashboard/");
    exit;
}
if (isset($_POST['login'])) {
    $email = trim($_POST['email']);
    $password = trim($_POST['password']);
    if ($control->login($email, $password)) {
        $_SESSION['auth'] = "1";
        /* no message is require take em to the dashboard. let em create/moderate content!
        		http://localhost:8888/contacts/admin/dashboard.php */
        header("location: ../dashboard/");
        exit;
    } else {
        $info = $info . $control->info;
    }
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head>
Example #20
0
function editExt($arrElements)
{
    $view_controller = new ViewController();
    $ext_empstat = new EXTRACTOR_EmployStat();
    $objEmpStat = $ext_empstat->parseEditData($arrElements);
    $view_controller->updateData('EST', $arrElements['txtEmpStatID'], $objEmpStat, true);
    $view_controller = new ViewController();
    $unAssEmpStat = $view_controller->xajaxObjCall($arrElements['txtJobTitleID'], 'JOB', 'unAssigned');
    $objResponse = new xajaxResponse();
    $xajaxFiller = new xajaxElementFiller();
    $xajaxFiller->setDefaultOptionName($GLOBALS['lang_Common_Select']);
    $objResponse = $xajaxFiller->cmbFiller($objResponse, $unAssEmpStat, 0, 'frmJobTitle', 'cmbUnAssEmploymentStatus', 0);
    $objResponse->addScript("document.frmJobTitle.txtEmpStatID.value = '';");
    $objResponse->addScript("document.frmJobTitle.txtEmpStatDesc.value = '';");
    $objResponse->addScript("document.frmJobTitle.txtEmpStatDesc.disabled = true;");
    $objResponse->addScript("document.getElementById('layerEmpStat').style.visibility='hidden';");
    $objResponse->addAssign('buttonLayer', 'innerHTML', '');
    $objResponse->addAssign('status', 'innerHTML', '');
    return $objResponse->getXML();
}
Example #21
0
/*
* include messages class
*/
require 'app/Messages.class.php';
/*
* include model
*/
require 'app/ViewModel.php';
/*
* include controller
*/
require 'app/ViewController.php';
/*
* set view data
*/
$MyController = new ViewController();
$view_data = $MyController->getView();
?>

<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>NetCoDev JsonCreator</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
    <style type="text/css">
        .jumbotron * {font-size: 11px !important;}
        .jumbotron h2 {font-size: 13px !important;font-weight: bold;padding-bottom:30px;}
        input[type=text] {width: 300px;}
 /**
  *Function for building search index
  */
 public function buildSearchIndexAction()
 {
     $this->_checkAccess();
     // turn off layout and ViewRenderer
     $this->_helper->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $roles = $this->getRoles();
     $i = 0;
     //$langCode = $this->_sesija->langAdmin;
     $langs = $this->getLanguages();
     // This cache doesn't expire, needs to be cleaned manually.
     $frontendOptions = array('caching' => true, 'lifetime' => null, 'ignore_user_abort' => true, 'automatic_serialization' => true);
     $backendOptions = array('cache_dir' => NET_PATH . 'cache/');
     $cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
     foreach ($langs as $langCode) {
         $pages = $this->_db->fetchAll("SELECT " . $this->_tblprefix . "pages_{$langCode}.output as outputPage, " . $this->_tblprefix . "pages_{$langCode}.description, " . $this->_tblprefix . "templates_{$langCode}.output as outputTemplate, " . $this->_tblprefix . "pages_{$langCode}.title, " . $this->_tblprefix . "pages_{$langCode}.alias, " . $this->_tblprefix . "pages_{$langCode}.id, " . $this->_tblprefix . "pages_{$langCode}.template_id FROM " . $this->_tblprefix . "pages_{$langCode} LEFT JOIN " . $this->_tblprefix . "templates_{$langCode} ON " . $this->_tblprefix . "pages_{$langCode}.template_id = " . $this->_tblprefix . "templates_{$langCode}.id");
         foreach ($pages as $page) {
             $output = $page['outputPage'];
             $outputTemplate = $page['outputTemplate'];
             $id = $page['id'];
             foreach ($roles as $role) {
                 if (!($results = $cache->load('page' . $id . "_" . $langCode . "_" . $role))) {
                     continue;
                 }
                 //if this cache exists already , dont do unrequired queries
                 $i++;
                 $out = ViewController::_templatePrepare($output . $outputTemplate);
                 $cacheResult = array('output' => $out, 'title' => $page['title'], 'metaDesc' => $page['description']);
                 $cache->save($cacheResult, 'page' . $id . "_" . $langCode . "_" . $role);
             }
         }
     }
     //print_r($pages);
     echo $i;
 }
Example #23
0
 public function __construct($route)
 {
     if (!isset($_SESSION)) {
         session_start();
     }
     if (!isset($_SESSION['ok'])) {
         $_SESSION['ok'] = false;
     }
     if ($_SESSION['ok']) {
         //accedemos con user y pass correcto a la plicación
         //echo '<h2>Bienvenido <mark>' . $_SESSION['user'] . '</mark> a Mexflix te has autenticado</h2>';
         $this->route = isset($_GET['r']) ? $_GET['r'] : 'home';
         $controller = new ViewController();
         switch ($this->route) {
             case 'home':
                 $controller->load_view('home');
                 break;
             case 'movieseries':
             case 'movieseries':
                 if (!isset($_POST['r'])) {
                     $controller->load_view('movieseries');
                 } else {
                     if ($_POST['r'] == 'movieserie-add') {
                         $controller->load_view('movieserie-add');
                     } else {
                         if ($_POST['r'] == 'movieserie-edit') {
                             $controller->load_view('movieserie-edit');
                         } else {
                             if ($_POST['r'] == 'movieserie-delete') {
                                 $controller->load_view('movieserie-delete');
                             } else {
                                 if ($_POST['r'] == 'movieserie-show') {
                                     $controller->load_view('movieserie-show');
                                 }
                             }
                         }
                     }
                 }
                 break;
             case 'usuarios':
                 if (!isset($_POST['r'])) {
                     $controller->load_view('users');
                 } else {
                     if ($_POST['r'] == 'user-add') {
                         $controller->load_view('user-add');
                     } else {
                         if ($_POST['r'] == 'user-edit') {
                             $controller->load_view('user-edit');
                         } else {
                             if ($_POST['r'] == 'user-delete') {
                                 $controller->load_view('user-delete');
                             }
                         }
                     }
                 }
                 break;
             case 'status':
                 if (!isset($_POST['r'])) {
                     $controller->load_view('status');
                 } else {
                     if ($_POST['r'] == 'status-add') {
                         $controller->load_view('status-add');
                     } else {
                         if ($_POST['r'] == 'status-edit') {
                             $controller->load_view('status-edit');
                         } else {
                             if ($_POST['r'] == 'status-delete') {
                                 $controller->load_view('status-delete');
                             }
                         }
                     }
                 }
                 break;
             case 'salir':
                 $user_session = new SessionController();
                 $user_session->logout();
                 break;
             default:
                 $controller->load_view('error404');
                 break;
         }
     } else {
         //la aplicación nos muestra un form de login
         if (!isset($_POST['user']) && !isset($_POST['pass'])) {
             //echo 'Tengo que mostrar un login form';
             $login_form = new ViewController();
             $login_form->load_view('login');
         } else {
             //echo 'Validar los datos que el usuario envía';
             $user_session = new SessionController();
             $session = $user_session->login($_POST['user'], $_POST['pass']);
             if (empty($session)) {
                 //echo 'El usuario y el password son incorrectos';
                 $login_form = new ViewController();
                 $login_form->load_view('login');
                 header('Location: ./?error=El usuario ' . $_POST['user'] . ' y el password proporcionado no coinciden');
             } else {
                 //echo 'El usuario y el password son correctos';
                 //var_dump($session);
                 $_SESSION['ok'] = true;
                 foreach ($session as $row) {
                     $_SESSION['user'] = $row['user'];
                     $_SESSION['email'] = $row['email'];
                     $_SESSION['name'] = $row['name'];
                     $_SESSION['birthday'] = $row['birthday'];
                     $_SESSION['pass'] = $row['pass'];
                     $_SESSION['role'] = $row['role'];
                 }
                 header('Location: ./');
             }
         }
     }
 }
 public function indexAction()
 {
     $translator = Zend_Registry::get('Zend_Translate');
     $langCode = $this->_sesija->lang;
     $values = $this->_request->getParams();
     $db = Zend_Registry::get('db');
     $page = $db->fetchAll("SELECT output, title, description, keywords, template_id FROM pages_{$langCode}  WHERE id = ?", array($values['pid']));
     $template = $db->fetchAll("SELECT output FROM templates_{$langCode} where id = ?", array($page[0]['template_id']));
     //Form
     $form = self::commentsForm($values['pid']);
     $formErrors = array();
     if ($this->_request->isPost() && $form->isValid($_POST)) {
         $values = $this->_request->getParams();
         //print_r($values);
         $pageId = $values['pid'];
         $contentType = 'page';
         $commentatorName = $values['commentatorName'];
         $commentatorEmail = $values['commentatorEmail'];
         $comment = $values['comment'];
         $status = '2';
         $replyToComment = '0';
         $rating = $values['star0'];
         //Do query
         $this->_db->query("INSERT INTO comments (pageId, contentType, commentatorName, commentatorEmail, comment, status, replyToComment) VALUES (?, ?, ?, ?, ?, ?, ?)", array($pageId, $contentType, $this->_sesija->user, $commentatorEmail, $comment, $status, $replyToComment));
         //rating
         if (isset($values['pid']) && isset($values['star0'])) {
             $ip = $_SERVER['REMOTE_ADDR'];
             $data = array('commentatorName' => $this->_sesija->user, 'commentatorIp' => $ip, 'rating' => $values['star0'] + 1, 'pageId' => $values['pid']);
             $check = $this->_db->fetchAll("SELECT count(id) as ratings FROM comments_ratings WHERE commentatorIp = ? AND pageId = ?", array($ip, $values['pid']));
             if ($check[0]['ratings'] == 0) {
                 $this->_db->insert('comments_ratings', $data);
                 $resTotal = $this->_db->fetchAll("SELECT round(AVG(rating)) as rating from comments_ratings WHERE pageId = ?", array($values['pid']));
                 $resTotalCount = $this->_db->fetchAll("SELECT COUNT(id) AS totalCount FROM comments_ratings WHERE pageId = ?", array($values['pid']));
                 //echo $resTotal[0]['rating'] . '|' . $resTotalCount[0]['totalCount'];
             } else {
                 //echo $translator->_("You already rated this article!");
             }
         }
         //$this->_db->query("INSERT INTO comments_ratings (pageId, contentType, commentatorName, commentatorEmail, comment, status, replyToComment) VALUES (?, ?, ?, ?, ?, ?, ?)", array($pageId, $contentType, $commentatorName, $commentatorEmail, $comment, $status, $replyToComment) );
         $content = $translator->_('<h2>Thank You for Your comment!</h2>');
         if (!empty($template)) {
             $out = ViewController::_liveBlocksPrepare(ViewController::_templatePrepare($template[0]['output'], $content . $page[0]['output']));
             $this->view->output = $out;
         }
     } else {
         $content = $form;
         if (!empty($template)) {
             $out = ViewController::_liveBlocksPrepare(ViewController::_templatePrepare($template[0]['output'], $content));
             $this->view->output = $out;
         }
     }
 }
Example #25
0
 public function testRenderUsingViewRenderer()
 {
     HelperBroker::addHelper(new Helper\ViewRenderer());
     $request = new Request\Http();
     $request->setControllerName('view')->setActionName('script');
     $response = new Response\Cli();
     Controller\Front::getInstance()->setControllerDirectory(__DIR__ . DIRECTORY_SEPARATOR . '_files');
     $controller = new \ViewController($request, $response);
     $controller->scriptAction();
     $this->assertContains('Inside custom/renderScript.php', $response->getBody());
 }
Example #26
0
 /**
  * 
  * @param type $vista
  * @return type
  */
 public function getHTML($vista)
 {
     return parent::getHTML("facebook", $vista);
 }
Example #27
0
				<input type="radio" name="category" id="movie" value="Movie" required><label for="movie">Movie</label>
				<input type="radio" name="category" id="serie" value="Serie" required><label for="serie">Serie</label>
			</div>
			<div class="p_25">
				<input  class="button  add" type="submit" value="Agregar">
				<input type="hidden" name="r" value="movieserie-add">
				<input type="hidden" name="crud" value="set">
			</div>
		</form>
	', $status_select);
} else {
    if ($_POST['r'] == 'movieserie-add' && $_SESSION['role'] == 'Admin' && $_POST['crud'] == 'set') {
        $ms_controller = new MovieSeriesController();
        $new_ms = array('imdb_id' => $_POST['imdb_id'], 'title' => $_POST['title'], 'plot' => $_POST['plot'], 'author' => $_POST['author'], 'actors' => $_POST['actors'], 'country' => $_POST['country'], 'premiere' => $_POST['premiere'], 'poster' => $_POST['poster'], 'trailer' => $_POST['trailer'], 'rating' => $_POST['rating'], 'genres' => $_POST['genres'], 'status' => $_POST['status'], 'category' => $_POST['category']);
        $ms = $ms_controller->set($new_ms);
        $template = '
		<div class="container">
			<p class="item  add">MovieSerie <b>%s</b> salvada</p>
		</div>
		<script>
			window.onload = function () {
				reloadPage("movieseries")
			}
		</script>
	';
        printf($template, $_POST['title']);
    } else {
        $controller = new ViewController();
        $controller->load_view('error401');
    }
}
Example #28
0
 public function login()
 {
     $app = $this->app;
     $args = $app->args;
     if ($app->is_admin()) {
         $app->redirect('/admin/dashboard');
     }
     parent::render('login.twig', $args);
 }
Example #29
0
 public function testRenderUsingViewRenderer()
 {
     Zend_Controller_Action_HelperBroker::addHelper(new Zend_Controller_Action_Helper_ViewRenderer());
     $request = new Zend_Controller_Request_Http();
     $request->setControllerName('view')->setActionName('script');
     $response = new Zend_Controller_Response_Cli();
     Zend_Controller_Front::getInstance()->setControllerDirectory(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files');
     require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'ViewController.php';
     $controller = new ViewController($request, $response);
     $controller->scriptAction();
     $this->assertContains('Inside custom/renderScript.php', $response->getBody());
 }
Example #30
0
 /**
  *Preparing contents from database to be rendered
  *with replacing of the template variables
  *
  *@author NT
  *
  */
 public static function _templatePrepare($outputDB, $content = null, $lang = null, $pageInfo = null)
 {
     $db = Zend_Registry::get('db');
     $title = Zend_Registry::get('pageTitle');
     $langCode = self::$lang;
     $langCode = Zend_Registry::get('langCode');
     if ($langCode == "") {
         //OVO MORA DA SE SKLONI!!!!!
         $langCode = "sr";
     }
     $replaceThis = preg_match_all('/[{].+[}]/', $outputDB, $matches);
     foreach ($matches[0] as $part) {
         $parts = explode(":", $part);
         $Tvars[] = $parts;
     }
     if (count(@$Tvars)) {
         foreach ($Tvars as $Tvarss) {
             $i = 0;
             foreach ($Tvarss as $TV) {
                 $module = trim($TV, "{}");
                 $build2[] = $module;
                 $i++;
             }
             $build[] = $build2;
             $build2 = array();
         }
     }
     //print_r($build);
     //print_r($matches);
     $count = 0;
     $cHI = 0;
     if (count(@$build)) {
         foreach ($build as $build_) {
             @($pattern = $matches[$count]);
             //TITLE OF THE PAGE
             //if (@preg_match("/{title}/", "{" . $build_[0] . "}" )) {
             if (@strstr("{" . $build_[0] . "}", "{title}")) {
                 $output = $title;
                 $outputDB = str_replace('{title}', $output, $outputDB);
             }
             //PAGE INFO HANDLE
             //if (@preg_match("/{searchform}/", "{" . $build_[0] . "}" )) {
             if (@strstr("{" . $build_[0] . "}", "{pageinfo}")) {
                 $output = ViewController::pageInfo($pageInfo);
                 $outputDB = str_replace('{pageinfo}', $output, $outputDB);
             }
             if (@strstr("{" . $build_[0] . "}", "{adminurl}")) {
                 $outputDB = str_replace('{adminurl}', '<a href="' . NetActionController::$hostRW . NetActionController::$adminUrl . '" target="_blank">Admin (FF!/Safari/Chrome)</a>', $outputDB);
             }
             //SEARCH HANDLE
             //if (@preg_match("/{searchform}/", "{" . $build_[0] . "}" )) {
             if (@strstr("{" . $build_[0] . "}", "{searchform}")) {
                 $output = SearchController::showSearchForm();
                 $outputDB = str_replace('{searchform}', $output, $outputDB);
             }
             //HTML PART HANDLE
             if (@strstr("{" . $build_[0], "{html")) {
                 //$codeAll = $build_[1] . ":" . $build_[2];
                 //$countBuild = count($build_);
                 $codeA = "";
                 foreach ($build_ as $countedB) {
                     $codeA .= $countedB . ":";
                 }
                 $codeA = ltrim($codeA, "html:");
                 $codeA = rtrim($codeA, ":");
                 $output = htmlspecialchars_decode($codeA);
                 $output = str_replace('<br />', "", $output);
                 $output = str_replace('<br>', "\n", $output);
                 //$output = '<script type="text/javascript">document.write(' ."\n" . $output . ');</script>';
                 $outputDB = str_replace('{html:' . $codeA . '}', $output, $outputDB);
                 //$outputDB = str_replace('{html' , $output, $outputDB);
             }
             //xHTML PART HANDLE - if this code block is to be xhtml purified
             if (@strstr("{" . $build_[0], "{x-html")) {
                 $codeA = "";
                 foreach ($build_ as $countedB) {
                     $codeA .= $countedB . ":";
                 }
                 $codeA = ltrim($codeA, "x-html:");
                 $codeA = rtrim($codeA, ":");
                 $output = htmlspecialchars_decode($codeA);
                 $output = str_replace('<br />', "", $output);
                 $output = str_replace('<br>', "\n", $output);
                 //$output = '<script type="text/javascript">document.write(' ."\n" . $output . ');</script>';
                 $outputDB = str_replace('{x-html:' . $codeA . '}', $output, $outputDB);
                 //$outputDB = str_replace('{html' , $output, $outputDB);
             }
             //LANGUAGE chooser
             //if (@preg_match("/{language:flags}/", "{" . $build_[0] . ":flags}" )) {
             if (@strstr("{" . $build_[0] . ":flags}", "{language:flags}")) {
                 $langsEnabled = NetActionController::getStaticEnabledLanguages();
                 /*
                 $langQ = $db->fetchAll("SELECT * FROM languages WHERE enabled = '1'");
                 foreach ($langQ as $lang) {
                     $langsEnabled[] = $lang['code'];
                 }
                 */
                 $output = ViewController::showLanguageChooser($langsEnabled);
                 $outputDB = str_replace('{language:flags}', $output, $outputDB);
             }
             //MENU HANDLE
             //if (@preg_match("/menu:display/", "{" . $build_[0] . ":" . $build_[1])) {
             if (@strstr($build_[0] . ":" . $build_[1], "menu:display")) {
                 $menuId = trim($build_[2], '""');
                 @($orientation = $build_[3]);
                 //if ($orientation =! "slide") {
                 //$menuQ = $db->fetchAll("SELECT *, url_en as url,name_en as name,description_en as description FROM menu_items  WHERE menu_id = ?", array($menuId));
                 //} else {
                 $menuQ = $db->fetchAll("SELECT *, menu_items.check_access as chkAccess, menu_items.content_id as cid, url_{$langCode} as url, name_{$langCode} as name, description_{$langCode} as description FROM menu_items LEFT JOIN pages_{$langCode} ON menu_items.content_id = pages_{$langCode}.id WHERE menu_id = ? AND pages_{$langCode}.published = '1' ORDER BY weight ASC", array($menuId));
                 //}
                 //print_r($menuQ );
                 if (!empty($menuQ)) {
                     $output = ViewController::displayMenu($menuQ, $orientation);
                     if ($orientation == "") {
                         $orient = "";
                     } elseif ($orientation == "vertical") {
                         $orient = ":vertical";
                     } elseif ($orientation == "tree") {
                         $orient = ":tree";
                     } elseif ($orientation == "slide") {
                         $orient = ":slide";
                     }
                     $outputDB = str_replace('{menu:display:' . $build_[2] . @$orient . '}', $output, $outputDB);
                 } else {
                     $outputDB = str_replace('{menu:display:' . $build_[2] . @$orient . '}', '<b style="color:red;">{menu:' . $build_[2] . '}Doesn\'t exist or it is empty!</b>', $outputDB);
                 }
             }
             //CATEGORIES
             //if (@preg_match("/category:display/", "{" . $build_[0] . ":" . $build_[1])) {
             if (@strstr($build_[0] . ":" . $build_[1], "category:display")) {
                 $catId = trim($build_[2], '""');
                 @($orientation = $build_[3]);
                 $catQ = $db->fetchAll("SELECT id, title, alias, category, image, description, check_access  FROM pages_{$langCode}  WHERE category = ? AND pages_{$langCode}.published = '1'", array($catId));
                 //$catQ = $db->fetchAll("SELECT id, title, alias, category, image, description, check_access  FROM pages_$langCode WHERE category = ? AND pages_$langCode.published = '1'", array($catId));
                 //$catQ = array();
                 $catItemsArray2 = $db->fetchAll("SELECT DISTINCT *, pages_{$langCode}.id as id, pages_{$langCode}.title as title, pages_{$langCode}.alias as alias, pages_{$langCode}.category as category, pages_{$langCode}.image, pages_{$langCode}.description, pages_{$langCode}.check_access as check_access FROM category_items LEFT JOIN  pages_{$langCode}  ON pages_{$langCode}.id = category_items.content_id WHERE category_items.category_id = ? AND pages_{$langCode}.published = '1' GROUP BY pages_{$langCode}.id DESC ", array($catId));
                 $catQ = array_merge($catQ, $catItemsArray2);
                 //$catQ = $catQ + $catItemsArray2;
                 //print_r($menuQ );
                 if (!empty($catQ)) {
                     $output = ViewController::displayCategory($catQ, $orientation);
                     if ($orientation == "") {
                         $orient = "";
                     } elseif ($orientation == "oldest") {
                         $orient = ":oldest";
                     } elseif ($orientation == "latest") {
                         $orient = ":latest";
                     } elseif ($orientation == "desc") {
                         $orient = ":desc";
                     }
                     $outputDB = str_replace('{category:display:' . $build_[2] . @$orient . '}', $output, $outputDB);
                 } else {
                     $outputDB = str_replace('{category:display:' . $build_[2] . @$orient . '}', '<b style="color:red;">{category:' . $build_[2] . '}Doesn\'t exist or it is empty!</b>', $outputDB);
                 }
             }
             //SLIDE cu3er
             if (@strstr("{" . $build_[0] . "}", "{cu3er}")) {
                 $output = ViewController::slides();
                 $outputDB = str_replace('{cu3er}', $output, $outputDB);
             }
             //DISPLAY IMAGES
             //if (@preg_match("/images:display/", "{" . $build_[0] . ":" . $build_[1])) {
             if (@strstr($build_[0] . ":" . $build_[1], "images:display")) {
                 $folder = trim($build_[2], '""');
                 $folder = trim($folder, "''");
                 @($image = trim($build_[3], "''"));
                 //$menuQ = $db->fetchAll("SELECT *, url_en as url,name_en as name,description_en as description FROM menu_items  WHERE menu_id = ?", array($menuId));
                 //print_r($menuQ );
                 if (!empty($folder)) {
                     if (empty($image)) {
                         $output = ViewController::displayImages($folder);
                         $imageOut = "";
                     } else {
                         $output = ViewController::displayImage($folder, $image);
                         $imageOut = ":'" . $image . "'";
                     }
                     $outputDB = str_replace('{images:display:' . $build_[2] . $imageOut . '}', $output, $outputDB);
                     //$outputDB = str_replace('{images:display:' . $build_[2]  . '}', "AAAAA", $outputDB);
                 } else {
                     $outputDB = str_replace('{images:display:' . $build_[2] . $imageOut . '}', '<b style="color:red;">{images:' . $build_[2] . '}Doesn\'t exist or it is empty!</b>', $outputDB);
                 }
             }
             //EXTERN Joomla!!
             if (@preg_match("/extern:joomla/", "{" . $build_[0] . ":" . $build_[1])) {
                 $folder = trim($build_[2], '""');
                 $folder = trim($folder, "''");
                 $type = trim($build_[2], '""');
                 //print_r($menuQ );
                 if (!empty($type)) {
                     $output = ViewController::displayExternJoomla($type);
                     $imageOut = "";
                     $outputDB = str_replace('{extern:joomla:' . $build_[2] . $imageOut . '}', $output, $outputDB);
                 } else {
                     $outputDB = str_replace('{extern:joomla:' . $build_[2] . $imageOut . '}', '<b style="color:red;">{images:' . $build_[2] . '}Doesn\'t exist or it is empty!</b>', $outputDB);
                 }
             }
             //MODULE 'FORM'
             if (@preg_match("/module:forms/", "{" . $build_[0] . ":" . $build_[1])) {
                 $contactFormName = trim($build_[2], "''");
                 $contactFormId = $db->fetchAll("SELECT *, mod_forms.name as formName FROM mod_forms LEFT JOIN mod_forms_fields ON mod_forms.id = mod_forms_fields.form_id WHERE enabled = '1' AND mod_forms.name = ?", array($contactFormName));
                 //print_r($contactFormId);
                 if (!empty($contactFormId)) {
                     $formId = $contactFormId;
                     $output = FormsController::showForm($formId);
                     $outputDB = str_replace('{module:forms:' . $build_[2] . '}', $output, $outputDB);
                 } else {
                     $outputDB = str_replace('{module:forms:' . $build_[2] . '}', '<b style="color:red;">{module:forms:' . $build_[2] . '}Doesn\'t exist!</b>', $outputDB);
                 }
             }
             $outputString = "";
             $count++;
         }
     } else {
         //$output = ViewController::setDefaultHeaderImage();
         //$outputDB .= $output;
     }
     $outputDB = str_replace('{content}', $content, $outputDB);
     return $outputDB;
 }