Пример #1
0
/**
 * nv_theme_blood_bank_detail()
 *
 * @param mixed $array_data
 * @return
 */
function nv_theme_blood_bank_detail($array_data, $array_history)
{
    global $global_config, $module_name, $module_file, $lang_module, $module_config, $module_info, $op, $array_sex, $array_blood_group;
    $array_data['birthday'] = !empty($array_data['birthday']) ? nv_date('d/m/Y', $array_data['birthday']) : '';
    $array_data['recent_time'] = !empty($array_data['recent_time']) ? nv_date('d/m/Y', $array_data['recent_time']) : '';
    $array_data['gender'] = $array_sex[$array_data['gender']];
    $array_data['blood_group'] = !empty($array_data['blood_group']) ? $array_blood_group[$array_data['blood_group']] : $lang_module['not_know'];
    $array_data['resident'] = nv_get_location($array_data['resident_p'], $array_data['resident_d'], $array_data['resident_w']);
    $array_data['temporarily'] = nv_get_location($array_data['temporarily_p'], $array_data['temporarily_d'], $array_data['temporarily_w']);
    if (!empty($array_data['photo']) and file_exists(NV_ROOTDIR . '/' . $array_data['photo'])) {
        $array_data['photo'] = NV_BASE_SITEURL . $array_data['photo'];
    } else {
        $array_data['photo'] = NV_BASE_SITEURL . 'themes/' . $module_info['template'] . '/images/users/no_avatar.jpg';
    }
    $xtpl = new XTemplate($op . '.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
    $xtpl->assign('LANG', $lang_module);
    $xtpl->assign('DATA', $array_data);
    if (!empty($array_data)) {
        foreach ($array_data as $key => $data) {
            if (!empty($data)) {
                $admin_field = array('email', 'phone', 'identity_card');
                if (in_array($key, $admin_field) and !defined('NV_IS_MODADMIN')) {
                    continue;
                }
                $xtpl->parse('main.' . $key);
            }
        }
    }
    if (!empty($array_history)) {
        foreach ($array_history as $history) {
            $history['time'] = !empty($history['time']) ? nv_date('d/m/Y', $history['time']) : '';
            $xtpl->assign('HISTORY', $history);
            $xtpl->parse('main.history.loop');
        }
        $xtpl->parse('main.history');
    }
    if (defined('NV_IS_MODADMIN')) {
        $xtpl->parse('main.admin');
    }
    $xtpl->parse('main');
    return $xtpl->text('main');
}
Пример #2
0
 foreach ($array_title as $key => $value) {
     $TextColumnIndex = PHPExcel_Cell::stringFromColumnIndex($columnIndex);
     $objWorksheet->setCellValue($TextColumnIndex . '4', $value);
     $columnIndex++;
 }
 $pRow = $Excel_Cell_Begin;
 $data_export = array();
 $db->sqlreset()->select('*')->from(NV_PREFIXLANG . '_' . $module_data)->where('1=1' . $where);
 $_query = $db->query($db->sql());
 $i = 1;
 while ($row = $_query->fetch()) {
     $row['no'] = $i;
     $row['birthday'] = !empty($row['birthday']) ? nv_date('d/m/Y', $row['birthday']) : '';
     $row['resident'] = nv_get_location($row['resident_p'], $row['resident_d'], $row['resident_w']);
     $row['resident'] = implode(', ', $row['resident']);
     $row['temporarily'] = nv_get_location($row['temporarily_p'], $row['temporarily_d'], $row['temporarily_w']);
     $row['temporarily'] = implode(', ', $row['temporarily']);
     $row['gender'] = $array_sex[$row['gender']];
     $data_export[$row['id']] = $row;
     $i++;
 }
 if (!empty($data_export)) {
     foreach ($data_export as $v) {
         $pRow++;
         $columnIndex = 0;
         foreach ($array_title as $key => $key_data) {
             $TextColumnIndex = PHPExcel_Cell::stringFromColumnIndex($columnIndex);
             $objWorksheet->setCellValue($TextColumnIndex . $pRow, $v[$key]);
             $objWorksheet->getStyle('A' . $pRow)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $objWorksheet->getStyle('H' . $pRow)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $columnIndex++;