Exemple #1
0
 function checkJquery()
 {
     $time = time();
     if ($this->ui_counter > 0) {
         $str = "\n\t\t\tif(typeof(jQuery) != 'function') {\n\n\t\t\t\tvar file = document.createElement('script');\n\t\t\t\tfile.src = '" . public_data("js/jquery.js") . "';\n\t\t\t\tfile.type = 'text/javascript';\n\t\t\t\tdocument.getElementsByTagName('head')[0].appendChild(file);\n\n\t\t\t\tvar file = document.createElement('script');\n\t\t\t\tfile.src = '" . public_data("js/jquery-ui.js") . "';\n\t\t\t\tfile.type = 'text/javascript';\n\t\t\t\tdocument.getElementsByTagName('head')[0].appendChild(file);\n\n\t\t\t\t_" . $time . "();\n\n\t\t\t} else {\n\n\t\t\t\t_" . $time . "();\n\t\t\t}\n\n\n\t\t\tfunction checkCss_" . $time . "() {\n\n\t\t\t\tvar css = false;\n\n\t\t\t\t\$('link').each(function () { \n\t\t\t\t\tif(\$(this).attr('href').indexOf('jquery-ui.css') >= 0) {\n\n\t\t\t\t\t\tcss = true;\n\t\t\t\t\t} \n\t\t\t\t});\n\n\t\t\t\tif(!css) {\n\n\t\t\t\t\tvar file\t= document.createElement('link');\n\t\t\t\t\tfile.href\t= '" . public_data("css/jquery-ui.css") . "';\n\t\t\t\t\tfile.type\t= 'text/css';\n\t\t\t\t\tfile.rel\t= 'stylesheet';\n\t\t\t\t\tfile.media\t= 'screen, projection';\n\t\t\t\t\tdocument.getElementsByTagName('head')[0].appendChild(file);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction _" . $time . "() {\n\n\t\t\t\tif(typeof(jQuery) != 'function' ||  typeof(jQuery().autocomplete) != 'function') { setTimeout('_" . $time . "()',700); return; }\n\t\t\t\tcheckCss_" . $time . "();\n\t\t\t";
     } else {
         $str = "\n\t\t\tif(typeof(jQuery) != 'function') {\n\t\n\t\t\t\tvar file = document.createElement('script');\n\t\t\t\tfile.src = '" . public_data("js/jquery.js") . "';\n\t\t\t\tfile.type = 'text/javascript';\n\t\t\t\tdocument.getElementsByTagName('head')[0].appendChild(file);\n\t\n\t\t\t\t_" . $time . "();\n\t\t\t} else {\n\t\t\n\t\t\t\t_" . $time . "();\n\t\t\t}\n\n\t\t\tfunction _" . $time . "() {\n\t\n\t\t\t\tif(typeof(jQuery) != 'function') { setTimeout('_" . $time . "()',700); return; }\n\t\t\t";
     }
     return $str;
 }
            <?php 
    foreach ($exam['fields'] as $field) {
        ?>
            <td>
            	<?php 
        if (strlen($row->{$field}) > 45) {
            ?>
                	<span title="<?php 
            echo htmlspecialchars(str_replace(array("<", ">"), array("&lt;", "&gt;"), $row->{$field}));
            ?>
"><?php 
            echo htmlspecialchars(substr($row->{$field}, 0, 45));
            ?>
</span>
                	<img class="expand" alt="expand" title="expand" style="vertical-align:sub;cursor:pointer;opacity:0.3;" src="<?php 
            echo public_data("img/tools/eye.png");
            ?>
" />
                <?php 
        } else {
            ?>
                	<span><?php 
            echo htmlspecialchars(substr($row->{$field}, 0, 45));
            ?>
</span>
                <?php 
        }
        //endif
        ?>
            </td>
            <?php 
        ?>
&nbsp;
                    </td>
                </tr>
            <?php 
    }
    //endforeach
    ?>
            </tbody>
        </table>
        <?php 
    if (!$isView) {
        ?>
        <a class="addfield" href="#" style="display: block; margin-top: 10px;">
        	<img src="<?php 
        echo public_data();
        ?>
img/tools/add.png" alt="" />
        	Add new field(s)
        </a>
        <?php 
    }
    //endif
    ?>
    </div>
    <div id="newField" style="display:none;">
        <form method="post" action="<?php 
    echo site_url();
    ?>
tools/dbmanager/ajax/altertable/addfield" >
        <input type="hidden" name="tablename" value="<?php 
 function masterview($view, $data = array(), $extra = 'default', $return = FALSE)
 {
     define('MASTERVIEW', TRUE);
     if (!file_exists(APPPATH . 'config/masterview' . EXT)) {
         show_error('Unable to load requested file: ' . APPPATH . 'config/masterview' . EXT);
     }
     if (!is_array($extra)) {
         $index = $extra;
     }
     require APPPATH . 'config/masterview' . EXT;
     foreach ($conf[$index] as $key => $val) {
         if ($val == "") {
             unset($conf[$index][$key]);
         }
     }
     if (!isset($wrapper)) {
         $wrapper = isset($conf["wrapper"]) ? $conf[$index]["wrapper"] : "wrapper";
     }
     $data = array_merge($conf[$index], $data);
     if (!function_exists("public_data")) {
         $fe =& get_instance();
         $fe->load->helper("url");
     }
     /*** set javascript files and ajax events ***/
     if (isset($data["js"]) and count($data["js"]) > 0) {
         require APPPATH . 'config/config' . EXT;
         if (!is_array($data["js"])) {
             $data["js"] = array($data["js"]);
         }
         if (isset($config['compact']['js']) and $config['compact']['js'] == true) {
             $external_js = array();
             $local_js = array();
             $tmp_js = array();
             $i = 0;
             foreach ($data["js"] as $item) {
                 if (strstr($item, "#")) {
                     $external_js[$i] = str_replace("#", public_data("js") . "/", $item);
                 } elseif (preg_match("/^(https?:\\/\\/)?[a-z\\-_]*\\.[a-z\\.]{0,6}\\/.*\\.js/i", $item)) {
                     $external_js[$i] = $item;
                 } else {
                     if (isset($local_js[$i - 1])) {
                         $local_js[$i - 1] .= "," . $item;
                         continue;
                     } else {
                         $local_js[$i] = $item;
                     }
                 }
                 $i++;
             }
             //endforeach
             if (count($external_js) > 0) {
                 $data["js"] = array("remote" => $external_js, "local" => $local_js);
             } else {
                 $data["js"] = array("local" => $local_js);
             }
         } else {
             $data["js"] = array("local" => $data["js"]);
         }
     }
     $data["view"] = $view;
     $this->view($wrapper, $data, $return);
 }
    //endforeach
    ?>
	
					<?php 
}
//endif
?>
					</ul>
				</div>
				<div style="width:32px;height:16px; position: absolute; visibility: hidden;">
					<img class="oculto left" src="<?php 
echo public_data("img/tools/arrow_left.png");
?>
" style="padding-right:10px;" />
					<img class="right" src="<?php 
echo public_data("img/tools/arrow_right.png");
?>
" style="padding-right:10px;" />
				</div>
			</form>
		</div>
	
		<form action="<?php 
echo site_url("tools/dbmanager/");
?>
" method="post">
		<?php 
if (count($db_conf) > 1) {
    ?>
			<div style="padding:2px;text-align:center;">
			DB conf: 
                ?>
						<script src="<?php 
                echo $js["remote"][$i];
                ?>
" type="text/javascript"></script>
					<?php 
            }
            //endif
        }
        //end for
    } else {
        for ($i = 0; $i < $kont; $i++) {
            if (isset($js["local"][$i])) {
                ?>
						<script src="<?php 
                echo public_data("js/" . $js["local"][$i]);
                ?>
" type="text/javascript"></script>
					<?php 
            } elseif (isset($js["remote"][$i])) {
                ?>
						<script src="<?php 
                echo $js["remote"][$i];
                ?>
" type="text/javascript"></script>
					<?php 
            }
            //endif
        }
        //end for*/
    }