/**
  * Retrieve the standard sidebar setted for the current page, excluding woocommerce pages.
  * 
  * @return string
  * @since 1.0.0
  */
 function yit_get_standard_corporate_sidebar()
 {
     $page = '';
     if (!is_internal()) {
         if (yit_get_option('enable-all-sidebar') == 1) {
             $page = 'all';
         } else {
             if (is_posts_page() || is_single() && get_post_type() == 'post' || is_page_template('blog.php')) {
                 $page = 'blog';
             } elseif (is_404()) {
                 $page = '404';
             } elseif (is_category()) {
                 $page = 'categories';
             } elseif (is_search()) {
                 $page = 'search';
             } elseif (is_archive()) {
                 $page = 'archives';
             } elseif (is_page()) {
                 $page = 'pages';
             }
         }
     } else {
         if (yit_get_option('enable-all-custom-sidebar') == 1) {
             $page = 'all-custom';
         } else {
             if (is_portfolio()) {
                 $page = 'portfolios';
             } elseif (is_gallery()) {
                 $page = 'galleries';
             } elseif (is_services()) {
                 $page = 'services';
             } elseif (is_testimonial()) {
                 $page = 'testimonial';
             }
         }
     }
     return $page;
 }
Exemple #2
0
 public function run($table, $cols, $rows)
 {
     function is_internal($field)
     {
         if ($field == 'id' or $field == 'updated_by' or $field == 'updated_at' or $field == 'counter' or $field == 'parent_id' or $field == 'company_id' or $field == 'member_id' or $field == 'owner_id' or $field == 'contact_id' or $field == 'support_id' or $field == 'opened_by' or $field == 'closed_by' or $field == 'assigned_to') {
             return true;
         } else {
             return false;
         }
     }
     $count_cols = count($cols);
     $dropped = 0;
     $count_rows = count($rows);
     $this->log_proxy('count_cols: ' . $count_cols);
     $this->log_proxy('count_rows: ' . $count_rows);
     $widths = '';
     foreach ($cols as $col) {
         $field = $col['Field'];
         if (is_internal($field)) {
             $dropped++;
             continue;
         }
         switch ($field) {
             case 'country':
                 $width = 40;
                 break;
             case 'description':
                 $width = 200;
                 break;
             case 'resolution':
                 $width = 200;
                 break;
             case 'sequence':
                 $width = 60;
                 break;
             case 'state':
                 $width = 40;
                 break;
             case 'status':
                 $width = 40;
                 break;
             case 'value':
                 $width = 200;
                 break;
             case 'zip':
                 $width = 40;
                 break;
             default:
                 $types = explode('(', $col['Type']);
                 $type = $types[0];
                 switch ($type) {
                     case 'bigint':
                         $width = 60;
                         break;
                     case 'char':
                         $width = 60;
                         break;
                     case 'date':
                         $width = 60;
                         break;
                     case 'datetime':
                         $width = 100;
                         break;
                     case 'decimal':
                         $width = 60;
                         break;
                     case 'int':
                         $width = 40;
                         break;
                     default:
                         $width = 100;
                         break;
                 }
         }
         //          $width = $col['Width'];
         $widths .= "\n" . '  <Column ss:AutoFitWidth="0" ss:Width="' . $width . '"/>';
     }
     $tops = "\n" . '<Row ss:StyleID="s22">' . "\n" . '<Cell><Data ss:Type="String"> Table:  ' . $table . '</Data></Cell>' . "\n" . '</Row>' . "\n" . '<Row ss:StyleID="s22">' . "\n" . '<Cell><Data ss:Type="String">  Time:  ' . date('Y-m-d H:m:s') . '</Data></Cell>' . "\n" . '</Row>' . "\n" . '<Row>' . "\n" . '</Row>';
     $head1 = '';
     $head2 = '';
     foreach ($cols as $col) {
         $field = $col['Field'];
         if (is_internal($field)) {
             continue;
         } else {
             $names = explode('_', $field);
             if (count($names) == 1) {
                 $name1 = ' ';
                 $name2 = $names[0];
             } else {
                 $name1 = $names[0];
                 $name2 = $names[1];
             }
             $head1 .= "\n" . '    <Cell ss:StyleID="s65"><Data ss:Type="String">' . $name1 . '</Data></Cell>';
             $head2 .= "\n" . '    <Cell ss:StyleID="s65"><Data ss:Type="String">' . $name2 . '</Data></Cell>';
         }
     }
     $body = '';
     foreach ($rows as $row) {
         $body .= "\n" . '<Row>';
         for ($c = 0; $c < $count_cols; $c++) {
             $col = $cols[$c];
             $field = $col['Field'];
             if (is_internal($field)) {
                 continue;
             } else {
                 $types = explode('(', $col['Type']);
                 $type = $types[0];
                 switch ($type) {
                     case 'bigint':
                         $ssStyle = '';
                         $ssType = 'Number';
                         break;
                     case 'date':
                         $ssStyle = 'shortDate';
                         $ssType = 'DateTime';
                         break;
                     case 'datetime':
                         $ssStyle = 'dateTime';
                         $ssType = 'DateTime';
                         break;
                     case 'decimal':
                         $ssStyle = '';
                         $ssType = 'Number';
                         break;
                     case 'int':
                         $ssStyle = '';
                         $ssType = 'Number';
                         break;
                     case 'char':
                         $ssStyle = 'char';
                         $ssType = 'String';
                         break;
                     default:
                         $ssStyle = '';
                         $ssType = 'String';
                         break;
                 }
                 $value = $row[$col['Field']];
                 if ($ssType == 'DateTime') {
                     $value = str_replace(' ', 'T', $value);
                     if ($value == '0000-00-00T00:00:00') {
                         $value = '';
                     }
                 }
                 if ($value == '') {
                     $ssType = 'String';
                 }
                 if ($field == 'country' or $field == 'fax' or $field == 'mobile' or $field == 'parent_name' or $field == 'phone' or $field == 'state' or $field == 'zip') {
                     $ssStyle = 'center';
                 }
                 if ($ssStyle != '') {
                     $ssStyle = ' ss:StyleID="' . $ssStyle . '"';
                 }
                 $value = htmlspecialchars($value);
                 $body .= "\n" . '<Cell' . $ssStyle . '><Data ss:Type="' . $ssType . '">' . $value . '</Data></Cell>';
             }
         }
         $body .= "\n" . '</Row>';
     }
     $body .= "\n" . ' </Table>';
     $names = '' . "\n" . ' <Worksheet ss:Name="Names">' . "\n" . '  <Table ss:ExpandedColumnCount="' . ($count_cols - $dropped) . '" ss:ExpandedRowCount="' . ($count_rows + 6) . '" x:FullColumns="1" x:FullRows="1">' . $widths . $tops . "\n" . '   <Row ss:StyleID="s22">' . $head1 . "\n" . '   </Row>' . "\n" . '   <Row ss:StyleID="s22">' . $head2 . "\n" . '   </Row>' . "\n" . '   <Row>' . "\n" . '   </Row>';
     $fileName = 'excel/Header.txt';
     $inpFile = fopen($fileName, 'r');
     $header = fread($inpFile, filesize($fileName));
     fclose($inpFile);
     $fileName = 'excel/Footer.txt';
     $inpFile = fopen($fileName, 'r');
     $footer = fread($inpFile, filesize($fileName));
     fclose($inpFile);
     header('Pragma: ');
     header('Cache-Control: ');
     header('Content-Type: application/x-msexcel');
     //     header( 'Content-Disposition: attachment; filename="' . $table . '.xlm"' );          //   generate *.xlm.xls
     //     header( 'Content-Disposition: inline; filename="' . $table . '.xlm"' );              //   generate *.xls
     header('Content-Disposition: inline; filename="' . $table . '.xls"');
     //   generate *.xls
     echo $header;
     echo $names;
     echo $body;
     echo $footer;
 }
Exemple #3
0
get_header();
do_action('yit_before_primary');
?>
<!-- START PRIMARY -->
<div id="primary" class="<?php 
yit_sidebar_layout();
?>
">
    <div class="inner group">
        <?php 
do_action('yit_before_content');
?>
        <!-- START CONTENT -->
        <div id="content-single" class="content group">
        <?php 
if (is_internal()) {
    do_action('yit_loop_internal');
} else {
    do_action('yit_loop');
}
comments_template();
?>
        </div>
        <!-- END CONTENT -->
        <?php 
do_action('yit_after_content');
?>
        
        <?php 
get_sidebar();
?>