Exemplo n.º 1
0
                    if (!($cname = $value->getCompanyName())) {
                        $cname = "none";
                    }
                    $this->tpl->set_var("companyName", $cname);
                    $this->tpl->set_var("tin", $value->getTin());
                    $this->tpl->set_var("telephone", $value->getTelephone());
                    $this->tpl->set_var("fax", $value->getFax());
                    $this->tpl->parse("CompanyListBlock", "CompanyList", true);
                }
            }
        }
        $this->tpl->parse("templatePage", "rptsTemplate");
        $this->tpl->finish("templatePage");
        $this->tpl->p("templatePage");
    }
}
#####################################
# Define Procedures and Functions
#####################################
##########################################################
# Begin Program Script
##########################################################
//*
page_open(array("sess" => "rpts_Session", "auth" => "rpts_Challenge_Auth"));
//*/
//print_r($sess);
$test = "labas";
$sess->register(test);
$companyList = new CompanyList($HTTP_POST_VARS, $sess);
$companyList->main();
page_close();
Exemplo n.º 2
0
 public static function preload($pids = array())
 {
     if (self::$fullload) {
         return;
     }
     // Load raw data
     if (count($pids)) {
         $join = 'LEFT JOIN profile_job ON (profile_job.jobid = pje.id)';
         $where = 'WHERE profile_job.pid IN ' . XDB::formatArray($pids);
     } else {
         $join = '';
         $where = '';
     }
     $it = XDB::iterator('SELECT  pje.id, pje.name, pje.acronym, pje.url,
                                  pa.flags, pa.text, pa.type, pa.pub
                            FROM  profile_job_enum AS pje
                       LEFT JOIN  profile_addresses AS pa ON (pje.id = pa.jobid AND pa.type = \'hq\')
                               ' . $join . '
                               ' . $where);
     $newcompanies = array();
     while ($row = $it->next()) {
         $cp = new Company($row);
         $addr = new Address($row);
         $cp->setAddress($addr);
         if (!array_key_exists($row['id'], self::$companies)) {
             $newcompanies[] = $row['id'];
         }
         self::$companies[$row['id']] = $cp;
     }
     // Add phones to hq
     if (count($newcompanies)) {
         $it = Phone::iterate(array(), array(Phone::LINK_COMPANY), $newcompanies, Visibility::defaultForRead());
         while ($phone = $it->next()) {
             self::$companies[$phone->link_id]->setPhone($phone);
         }
     }
     if (count($pids) == 0) {
         self::$fullload = true;
     }
 }