/**
     * Render the "Upload Many" tab.
     */
    function render_upload_many()
    {
        global $CFG;
        echo "<noscript><p><strong>", get_string('noscriptwarning', 'sloodle'), "</strong></p><p>&nbsp;</p></noscript>\n";
        // Setup variables to store the data
        $entryid = 0;
        $entryname = '';
        $entryurl = '';
        $entrytype = '';
        // Fetch a list of existing slides
        $entries = $this->presenter->get_entry_urls();
        // Check what position we are adding the new slide to
        // (default to negative, which puts it at the end)
        $position = (int) optional_param('sloodleentryposition', '-1', PARAM_INT);
        // Fetch our translation strings
        $streditpresenter = get_string('presenter:edit', 'sloodle');
        $strviewanddelete = get_string('presenter:viewanddelete', 'sloodle');
        $strnoentries = get_string('noentries', 'sloodle');
        $strdelete = get_string('delete', 'sloodle');
        $strBulkUpload = get_string('presenter:bulkupload', 'sloodle');
        $stradd = get_string('presenter:addfiles', 'sloodle');
        $strtype = get_string('type', 'sloodle');
        $strurl = get_string('url', 'sloodle');
        $strname = get_string('name', 'sloodle');
        $strposition = get_string('position', 'sloodle');
        $strsave = get_string('save', 'sloodle');
        $strend = get_string('end', 'sloodle');
        $stryes = get_string('yes');
        $strno = get_string('no');
        $strcancel = get_string('cancel');
        $strmove = get_string('move');
        $stredit = get_string('edit', 'sloodle');
        $strview = get_string('view', 'sloodle');
        $strdelete = get_string('delete');
        // Construct an array of available entry types, associating the identifier to the human-readable name.
        // In future, this will be built from a list of plugins, but for now we'll hard code it.
        $availabletypes = array();
        $availabletypes['image'] = get_string('presenter:type:image', 'sloodle');
        $availabletypes['video'] = get_string('presenter:type:video', 'sloodle');
        $availabletypes['web'] = get_string('presenter:type:web', 'sloodle');
        //display instructions
        echo get_string('presenter:uploadInstructions', 'sloodle');
        // We'll post the data straight back to this page
        echo '<form action="" method="post"><fieldset style="border-style:none;">';
        // Identify the module
        /*
         * Uploadify Multiple File uploader added by Paul Preibisch
         * @see http://www.uploadify.com/documentation
         * 
         * @var uploadWwwDir         - place to store files
         * @var uploadArray[]          - array to hold complete file names  
         * @var extension            - temp var to hold extension type of current file
         * @var tableData            - used to construct table rows
         * @uses upload.php          - upload.php is the upload handler script
         * @uses uploader.swf        - enables multiple file uploading     
         */
        echo '<script type="text/javascript">';
        echo 'var uploadWwwDir="' . $CFG->wwwroot . '/file.php/1/presenter/' . $this->cm->id . '/";';
        echo ' var uploadArray = [];';
        echo ' var qSize=0;';
        echo 'var uploadLimit=' . (int) INI_GET('post_max_size') * 1000000 . ';';
        echo ' var uploadArrayLen=0;';
        echo ' var counter=0;';
        echo ' var extension=\'\';';
        echo ' var tableData=\'\';';
        ?>
    function startUpload(id){  ;
        if (qSize < uploadLimit)
            $('#fileInput').fileUploadStart();
    }        <?php 
        // when DOM is fully loaded, JQuery ready function executes our code
        echo '$(document).ready(function() {';
        echo '$("#uploadButton").hide();';
        echo '$(\'#fileInput\').fileUpload ({';
        echo "'uploader'  : 'lib/multiplefileupload/uploader.swf',";
        echo "'script'    : 'lib/multiplefileupload/upload.php',";
        //sends moduleID:cm->id to upload.php upload handler
        echo "'scriptData' : {'moduleId':'" . $this->cm->id . "'},";
        //enable multiple uploads
        echo "'multi'     :  true,";
        //set cancel button image
        echo "'cancelImg' : 'lib/multiplefileupload/cancel.png',";
        //set button text
        echo "'buttonText': 'Select Files',";
        //start uploading automatically after items are selected
        echo "'auto'      : false,";
        //this folder variable is required, but in our case, not used because we set the upload folder in the upload.php upload handler
        echo "'folder'    : 'uploads',";
        //allowable file types (must also modify upload.php upload handler to accept these)
        echo "'fileDesc'  : 'jpg;png;gif;htm;html;mov',";
        //the allowable extensions in the file dialog view
        echo "'fileExt'   :   '*.jpg;*.png;*.gif;*.htm;*.html;*.mov',";
        //Send an alert on all errors
        ?>
onError: function (a, b, c, d) {
         if (d.status == 404)
            alert('Uploader error: could not find upload script (404).');
         else if (d.type === "HTTP")
            alert('Uploader error - '+d.type+": "+d.status);
         else if (d.type ==="File Size")
            alert(c.name+' '+d.type+' Limit: '+Math.round(d.sizeLimit/1024)+'KB');
         else
            alert('Uploader error - '+d.type+": "+d.text);
},        <?php 
        /*
         * onAllComplete will trigger after all uploads are done
         * When all uploaded, sort file names into alphabetical order
         * 
         */
        echo "'onAllComplete': function() {";
        //Files could have uploaded in a random order, therefore, lets sort the array of file names and display them alphabetically
        echo "uploadArray.sort();";
        //bind a variable fileDisplayArea to the tag <div id="filesUploaded"> so we can refer to it easily
        echo 'var fileDisplayArea = $("#filesUploaded");';
        //now append another div tag inside of it called fileTables - here we will put all fields for each item uploaded
        //<dif id="fileTables></div> is necessary because everytime the user presses Select files button, we must delete all elements in the div and redisplay so that all items are sorted properly
        echo 'fileDisplayArea.append($ (\'<div id="fileTables"></div>\'));';
        //bind a variable fileTables to the tag <div id="fileTables"> so we can refer to it easily
        echo 'var jList = $( "#fileTables" );';
        //iterate through all files uploaded
        echo '$.each(uploadArray,';
        echo 'function( intIndex, objValue ){';
        //get the extension of the uploaded file
        echo 'var start = objValue.length-4;';
        echo 'extension=objValue.substr(start,4);';
        echo 'extension=extension.toLowerCase();';
        echo 'var fname = objValue.substr(0,objValue.length-4);';
        //Construct the Name row
        //replace all spaces with underscores
        echo 'tableData= \'<table ><tr><td width=100>Name:</td><td> <input type="text" id="filename"  name="filename[]" value="\'+fname.replace(\' \\(\',\'_\\(\').replace(\'\\) \',\'\\)_\').replace(\' \',\'_\').replace(\' \',\'_\')+\'" size="60" maxlength="255" /></td><td width="100">\';';
        //Construct the Image row if this file is an image
        echo 'if ((extension==\'.jpg\') || (extension==\'.gif\') || (extension==\'.png\')) {';
        echo 'tableData += \'<label>Type:</label><select name="ftype[]" id="type" size="1"><option name=""  value="">image</option></select></td></tr></table>\';';
        echo 'tableData += \'<table ><tr><td><img src="\'+uploadWwwDir+objValue.replace(\' \\(\',\'_\\(\').replace(\'\\) \',\'\\)_\').replace(\' \',\'_\')+\'" width="100" height="100"></td></tr></table>\';';
        echo '}';
        //Construct movie row if this is a movie
        echo ' else if (extension==\'.mov\') {';
        echo 'tableData+=  \'<label>Type:</label><select name="" id="type" size="1"><option name="" value="">video</option></select></td></tr></table>\';';
        //quicktime embed tag added
        //replace all spaces with underscores
        echo 'tableData += \'<table ><tr><td><embed src="\'+uploadWwwDir+objValue.replace(\' \\(\',\'_\\(\').replace(\'\\) \',\'\\)_\').replace(\' \',\'_\')+\'" width="100" height="100" autohref="false"></td></tr></table>\'';
        echo '}';
        //Construct movie row if this is an htm or html page
        echo ' else if ((extension==\'.htm\') ||(extension==\'html\'))  {';
        echo 'tableData+= \'<label>Type:</label><select name="" id="type" size="1"><option name=""   value="">web</option></select></td></tr></table>\';';
        echo '}';
        //Now add the constructed row (tableData) to the list of fields
        echo 'tableData+=\'<table ><tr><td width=100>Url:</td><td><input type="text"  id="fileurl" name="fileurl[]" value="\'+uploadWwwDir+objValue.replace(\' \\(\',\'_\\(\').replace(\'\\) \',\'\\)_\').replace(\' \',\'_\').replace(\' \',\'_\')+\'" size="60" maxlength="255" /></td></tr></table><HR>\';';
        //insert the table data into <div id="fileTables"></div>
        echo 'jList.append($ (tableData));';
        echo ' });';
        //insert a submit button into <div id="fileTables"></div>
        echo 'jList.append($ (\'<input type="submit" value="' . $stradd . '" name="fileaddentry" />\'));';
        echo ' $("#uploadButton").hide();';
        echo ' $("#qSize").hide();';
        echo 'qSize=0;';
        echo ' },';
        ?>
                'onSelect': function (event,queueID,fileObj){
                   $("#qSize").show();
              qSize += fileObj.size;
               if (qSize > uploadLimit){
                 $("#uploadButton").hide();
                 $("#qSize").css("color","#a00");
                 $("#qSize").html("<br/><strong>Sorry! You have exceeded the maximum upload size. Please select fewer items, or use smaller files.</strong>");
              } else 
              { 
                $("#uploadButton").show();
                $("#qSize").css("color","#0a0");
                //$("#qSize").html(qSize+" bytes selected. <b>"+(uploadLimit-qSize) + "</b> bytes available to queue");
                //$("#qSize").html("");
                
                var _percentFull = qSize * 100.0 / uploadLimit;
                if (qSize == 0) $("#qSize").html("<br/>Upload queue is empty.");
                else if (_percentFull < 1) $("#qSize").html("<br/>Upload queue is less than 1% full.");
                else $("#qSize").html("<br/>Upload queue is about "+Math.round(_percentFull)+"% full.");
              }

        
        },
        
               'onCancel': function (event,queueID,fileObj){
              qSize -= fileObj.size;
              
              if (qSize > uploadLimit){
                $("#uploadButton").hide();
                $("#qSize").css("color","#a00");
                $("#qSize").html("<br/><strong>Sorry! You have exceeded the maximum upload size. Please select fewer items, or use smaller files.</strong>");
              } else 
              { 
                $("#uploadButton").show();
                $("#qSize").css("color","#0a0");
                
                var _percentFull = qSize * 100.0 / uploadLimit;
                if (qSize == 0) $("#qSize").html("<br/>Upload queue is empty.");
                else if (_percentFull < 1) $("#qSize").html("<br/>Upload queue is less than 1% full.");
                else $("#qSize").html("<br/>Upload queue is about "+Math.round(_percentFull)+"% full.");
              }
              
        
        },
        <?php 
        /*
         * onComplete will trigger after each upload is done
         * When a file is uploaded, add it to the uploadArray array
         * 
         */
        echo "'onComplete': function(event, queueID, fileObj, response, data) {";
        // add this file to our uploadArray
        echo "uploadArray[uploadArrayLen]=fileObj.name;";
        echo "uploadArrayLen++;";
        //clear the fileTables div so we can re-display all files in proper order
        echo "\$('#fileTables').remove();";
        echo "}   ";
        echo " });   });";
        echo "</script>";
        echo '<input type="file" name="fileInput" id="fileInput" />';
        //this div is where the uploaded files will be displayed
        echo '<div name="filesUploaded" id="filesUploaded"><div name="fileTables" id="fileTables"></div></div>';
        echo '<div name="qSize" id="qSize"></div></fieldset>';
        echo '<div style="display:none;" name="uploadButton" id="uploadButton"><a href="javascript:startUpload(\'fileUpload\')">Start Upload</a>';
        echo "&nbsp;&nbsp;|&nbsp;&nbsp;<a href=\"?id={$this->cm->id}&amp;mode=edit\">Cancel Upload</a>";
        echo '</div></form>';
    }
Beispiel #2
0
                if ($reporting & $er) {
                    $text[] = $name;
                }
            }
            printf(gettext('PHP Error reporting: <strong>%s</strong>'), implode(' | ', $text));
            ?>
			</li>
		<?php 
        }
        ?>
		<li><?php 
        printf(gettext("Graphics support: <strong>%s</strong>"), $graphics_lib['Library_desc']);
        ?>
</li>
		<li><?php 
        printf(gettext('PHP memory limit: <strong>%1$s</strong> (Note: Your server might allocate less!)'), INI_GET('memory_limit'));
        ?>
</li>
		<li>
			<?php 
        $dbsoftware = db_software();
        printf(gettext('%1$s version: <strong>%2$s</strong>'), $dbsoftware['application'], $dbsoftware['version']);
        ?>

		</li>
		<li><?php 
        printf(gettext('Database name: <strong>%1$s</strong>'), db_name());
        ?>
</li>
		<li>
		<?php 
/**
 * Expose some informations in a HTML comment
 *
 * @param string $obj the path to the page being loaded
 * @param array $plugins list of activated plugins
 * @param string $theme The theme being used
 */
function exposeZenPhotoInformations($obj = '', $plugins = '', $theme = '')
{
    global $_zp_filters;
    $a = basename($obj);
    if ($a != 'full-image.php') {
        echo "\n<!-- zenphoto version " . ZENPHOTO_VERSION . " [" . ZENPHOTO_FULL_RELEASE . "]";
        echo " THEME: " . $theme . " (" . $a . ")";
        $graphics = zp_graphicsLibInfo();
        $graphics = sanitize(str_replace('<br />', ', ', $graphics['Library_desc']), 3);
        echo " GRAPHICS LIB: " . $graphics . " { memory: " . INI_GET('memory_limit') . " }";
        echo ' PLUGINS: ';
        if (count($plugins) > 0) {
            sort($plugins);
            foreach ($plugins as $plugin) {
                echo $plugin . ' ';
            }
        } else {
            echo 'none ';
        }
        echo " -->";
    }
}
/**
 * Expose some informations in a HTML comment
 *
 * @param string $obj the path to the page being loaded
 * @param array $plugins list of activated plugins
 * @param string $theme The theme being used
 * @param string $filters list of the activated filters
 */
function exposeZenPhotoInformations($obj = '', $plugins = '', $theme = '', $filters = '')
{
    global $zenpage_version, $_zp_filters;
    $a = basename($obj);
    if ($a != 'full-image.php') {
        if (defined('RELEASE')) {
            $official = 'Official Build';
        } else {
            $official = 'SVN';
        }
        echo "\n<!-- zenphoto version " . ZENPHOTO_VERSION . " [" . ZENPHOTO_RELEASE . "] ({$official})";
        if (isset($zenpage_version)) {
            echo ' zenpage version ' . $zenpage_version . ' [' . ZENPAGE_RELEASE . '] ';
        }
        echo " THEME: " . $theme . " (" . $a . ") { memory: " . INI_GET('memory_limit') . " }";
        echo ' PLUGINS: ';
        if (count($plugins) > 0) {
            sort($plugins);
            foreach ($plugins as $plugin) {
                echo $plugin . ' ';
            }
        } else {
            echo 'none';
        }
        if (count($filters) > 0) {
            ksort($filters);
            echo 'FILTERS: ';
            foreach ($filters as $filter => $array_of_priority) {
                foreach ($array_of_priority as $priority => $array_of_filters) {
                    echo "{$filter} [";
                    foreach ($array_of_filters as $data) {
                        echo "{$priority}: " . $data['script'] . '=>' . $data['function'];
                    }
                    echo '] ';
                }
            }
        } else {
            echo 'none';
        }
        echo " -->";
    }
}