/**
* Publish widget
* @return array
*/
function mywords_widget_publish($post = null, $frontend = false)
{
    global $xoopsUser;
    RMTemplate::get()->add_style('publish_widget.css', 'mywords');
    RMTemplate::get()->add_style('forms.css', 'rmcommon');
    RMTemplate::get()->add_style('jquery.css', 'rmcommon');
    RMTemplate::get()->add_script('scripts.php?file=posts.js', 'mywords', array('directory' => 'include', 'footer' => 1));
    RMTemplate::get()->add_script(XOOPS_URL . '/modules/mywords/include/js/mktime.js');
    RMTemplate::get()->add_script('forms.js', 'rmcommon');
    $widget['title'] = __('Publish', 'mywords');
    $widget['icon'] = '';
    $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : 0;
    $edit = false;
    if (isset($post) && is_a($post, 'MWPost') && !$post->isNew()) {
        $edit = true;
        switch ($post->getVar('status')) {
            case 'draft':
                $status = __('Draft', 'mywords');
                break;
            case 'pending':
                $status = __('Pending review', 'mywords');
                break;
            case 'publish':
                $status = __('Published', 'mywords');
                break;
            case 'scheduled':
                $status = __('Scheduled', 'mywords');
                break;
        }
        $visibility = $post->getVar('visibility') == 'public' ? 'Public' : ($post->getVar('visibility') == 'password' ? 'Password Protected' : 'Private');
    } else {
        $status = 'Published';
        $visibility = 'Public';
    }
    ob_start();
    ?>
<div class="rmc_widget_content_reduced publish_container">
<form id="mw-post-publish-form">
<!-- Opciones de Publicación -->
<div class="publish_options">
<?php 
    _e('Status:', 'mywords');
    ?>
 <strong id="publish-status-legend"><?php 
    _e($status, 'mywords');
    ?>
</strong> &nbsp; <a href="javascript:;" id="edit-publish"><?php 
    _e('Edit', 'mywords');
    ?>
</a>
	<div id="publish-options" style="display: none;">
		<select name="status" id="status">
            <option value="publish"<?php 
    echo $edit && $post->getVar('status') == 'publish' ? 'selected="selected"' : ($edit ? '' : 'selected="selected"');
    ?>
><?php 
    _e('Published', 'mywords');
    ?>
</option>
			<option value="draft"<?php 
    echo $edit && $post->getVar('status') == 'draft' ? 'selected="selected"' : '';
    ?>
><?php 
    _e('Draft', 'mywords');
    ?>
</option>
			<option value="pending"<?php 
    echo $edit && $post->getVar('status') == 'pending' ? 'selected="selected"' : '';
    ?>
><?php 
    _e('Pending Review', 'mywords');
    ?>
</option>
		</select>
		<input type="button" name="publish-ok" id="publish-ok" class="button" value="<?php 
    _e('Apply', 'mywords');
    ?>
" /><br />
		<a href="javascript:;" onclick="$('#publish-options').slideUp('slow'); $('#edit-publish').show();"><?php 
    _e('Cancel', 'mywords');
    ?>
</a>
	</div>
</div>
<!-- //Opciones de Publicación -->
<!-- Visibilidad -->
<div class="publish_options">
<?php 
    _e('Visibility:', 'mywords');
    ?>
 <strong id="visibility-caption"><?php 
    _e($visibility, 'mywords');
    ?>
</strong> &nbsp; <a href="javascript:;" id="visibility-edit"><?php 
    _e('Edit', 'mywords');
    ?>
</a>
<?php 
    if (!$edit) {
        $visibility = 'public';
    } else {
        $visibility = $post->getVar('visibility');
    }
    ?>
    <div id="visibility-options">
        <input type="radio" name="visibility" value="public" id="visibility-public"<?php 
    echo $visibility == 'public' ? ' checked="checked"' : '';
    ?>
 /> <label for="visibility-public"><?php 
    _e('Public', 'mywords');
    ?>
</label><br />
        <input type="radio" name="visibility" value="password" id="visibility-password"<?php 
    echo $visibility == 'password' ? ' checked="checked"' : '';
    ?>
 /> <label for="visibility-password"><?php 
    _e('Password protected', 'mywords');
    ?>
</label><br />
        <span id="vis-password-text" style="<?php 
    _e($visibility == 'password' ? '' : 'display: none');
    ?>
">
            <label>
            <?php 
    _e('Password:'******'mywords');
    ?>
            <input type="text" name="vis_password" id="vis-password" value="<?php 
    echo $edit ? $post->getVar('password') : '';
    ?>
" class="options_input" />
            </label>
        <br /></span>
        <input type="radio" name="visibility" value="private" id="visibility-private"<?php 
    echo $visibility == 'private' ? ' checked="checked"' : '';
    ?>
 /> <label for="visibility-private"><?php 
    _e('Private', 'mywords');
    ?>
</label><br /><br />
        <input type="button" name="vis-button" id="vis-button" value="<?php 
    _e('Apply', 'mywords');
    ?>
" class="button" />
        <a href="javascript:;" id="vis-cancel"><?php 
    _e('Cancel', 'mywords');
    ?>
</a>
    </div>
</div>
<!-- /Visibilidad -->
<!-- Schedule -->
<div class="publish_options">
<?php 
    _e('Publish', 'mywords');
    ?>
 <strong id="schedule-caption"><?php 
    echo $edit ? $post->getVar('pubdate') > 0 ? __('Inmediatly', 'mywords') : date("d, M Y \\@ H:i", $post->getVar('schedule')) : __('Inmediatly', 'mywords');
    ?>
</strong> &nbsp; <a href="javascript:;" class="edit-schedule"><?php 
    _e('Edit', 'mywords');
    ?>
</a>
    <div class="schedule-options" style="display: none;">
        <?php 
    // Determinamos la fecha correcta
    $time = $edit ? $post->getVar('pubdate') > 0 ? $post->getVar('pubdate') : $post->getVar('schedule') : time();
    $day = date("d", $time);
    $month = date("n", $time);
    $year = date("Y", $time);
    $hour = date("H", $time);
    $minute = date("i", $time);
    $months = array(__('Jan', 'mywords'), __('Feb', 'mywords'), __('Mar', 'mywords'), __('Apr', 'mywords'), __('May', 'mywords'), __('Jun', 'mywords'), __('Jul', 'mywords'), __('Aug', 'mywords'), __('Sep', 'mywords'), __('Oct', 'mywords'), __('Nov', 'mywords'), __('Dec', 'mywords'));
    ?>
        <input type="text" name="schedule_day" id="schedule-day" size="2" maxlength="2" value="<?php 
    _e($day);
    ?>
" />
        <select name="schedule_month" id="schedule-month">
            <?php 
    for ($i = 1; $i <= 12; $i++) {
        ?>
                <option value="<?php 
        echo $i;
        ?>
" <?php 
        if ($month == $i) {
            echo 'selected="selected"';
        }
        ?>
><?php 
        echo $months[$i - 1];
        ?>
</option>
            <?php 
    }
    ?>
        </select>
        <input type="text" name="schedule_year" id="schedule-year" size="2" maxlength="4" value="<?php 
    echo $year;
    ?>
" /> @
        <input type="text" name="schedule_hour" id="schedule-hour" size="2" maxlength="2" value="<?php 
    echo $hour;
    ?>
" /> :
        <input type="text" name="schedule_minute" id="schedule-minute" size="2" maxlength="2" value="<?php 
    echo $minute;
    ?>
" /><br /><br />
        <input type="button" class="button" name="schedule-ok" id="schedule-ok" value="<?php 
    _e('Apply', 'mywords');
    ?>
" />
        <a href="javascript:;" class="schedule-cancel"><?php 
    _e('Cancel', 'mywords');
    ?>
</a>
        <input type="hidden" name="schedule" id="schedule" value="<?php 
    echo "{$day}-{$month}-{$year}-{$hour}-{$minute}";
    ?>
" />
    </div>
</div>
<!-- /Shedule -->
    <?php 
    if (!$frontend) {
        ?>
        <div class="publish_options no_border">
        <?php 
        _e('Author:', 'mywords');
        ?>
        <?php 
        $user = new RMFormUser('', 'author', 0, $edit ? array($post->getVar('author')) : array($xoopsUser->uid()));
        if (!$xoopsUser->isAdmin()) {
            $user->button(false);
        }
        echo $user->render();
        ?>
        </div>
    <?php 
    } else {
        ?>
        <input type="hidden" name="author" value="<?php 
        echo $xoopsUser->uid();
        ?>
">
    <?php 
    }
    ?>
<div class="widget_button">

<button type="button" class="button default btn btn-primary" id="publish-submit"><?php 
    $edit ? _e('Update Post', 'mywords') : _e('Publish', 'mywords');
    ?>
</button>
</div>


</form>
</div>
<?php 
    $widget['content'] = ob_get_clean();
    return $widget;
}
Exemple #2
0
/**
* Author information
*/
function dt_widget_credits($edit = 0)
{
    global $xoopsUser;
    //$widget['title'] = __('Author Information','dtransport');
    //$widget['icon'] = '../images/author.png';
    if ($edit) {
        $sw = new DTSoftware(rmc_server_var($_GET, 'id', 0));
    } else {
        $sw = new DTSoftware();
    }
    $field = new RMFormUser('', 'user', 0, $edit ? array($sw->getVar('uid')) : $xoopsUser->uid(), 50);
    $user = $field->render();
    unset($field);
    ob_start();
    ?>
    <form name="frmCredits" id="frm-credits" method="post">
    <div id="tab-credits" class="widgets_forms">
        <div class="item">
            <label><?php 
    _e('Published by', 'dtransport');
    ?>
</label>
            <?php 
    echo $user;
    ?>
        </div>
        <div class="item">
            <label for="author"><?php 
    _e('Author name', 'dtransport');
    ?>
</label>
            <input type="text" name="author" id="author" value="<?php 
    echo $edit ? $sw->getVar('author_name') : '';
    ?>
" class="fullwidth" />
        </div>
        <div class="item">
            <label for="url"><?php 
    _e('Author URL', 'dtransport');
    ?>
</label>
            <input type="text" name="url" id="url" value="<?php 
    echo $edit ? $sw->getVar('author_url') : '';
    ?>
" class="fullwidth" />
        </div>
        <div class="item">
            <label for="email"><?php 
    _e('Author Email', 'dtransport');
    ?>
</label>
            <input type="text" name="email" id="email" value="<?php 
    echo $edit ? $sw->getVar('author_email') : $xoopsUser->email();
    ?>
" class="fullwidth" />
            <span class="description"><?php 
    _e('This email will not be visible for users', 'dtransport');
    ?>
</span>
        </div>
        <div class="item">
            <input type="checkbox" name="contact" id="contact" value="1"<?php 
    echo $sw->getVar('author_contact') ? ' checked="checked"' : '';
    ?>
 /> <?php 
    _e('Author can be contacted', 'dtransport');
    ?>
        </div>
    </div>
    </form>
    <?php 
    $content = ob_get_clean();
    return $content;
}
                    <div class="form-group">
                        <label for="new-bio"><?php 
    _e('Biography:', 'mywords');
    ?>
</label>
                        <textarea name="bio" id="new-bio" class="form-control" rows="4"></textarea>
                    </div>

                    <div class="form-group">
                        <label for="new-user"><?php 
    _e('Registered user:'******'mywords');
    ?>
</label>
                        <?php 
    $ele = new RMFormUser('', 'new_user');
    echo $ele->render();
    ?>
                    </div>

                    <div class="form-group">
                        <label for="new-perm"><?php 
    _e('Privilieges:', 'mywords');
    ?>
</label>
                        <div class="checkbox">
                            <label><input type="checkbox" name="perms[]" value="tags" checked="checked" /> <?php 
    _e('Create tags', 'mywords');
    ?>
</label>
                        </div>
                        <div class="checkbox">
Exemple #4
0
/**
* @desc Formulario de creación de muchas imágenes
**/
function formBulkImages()
{
    global $mc, $xoopsUser, $tpl, $xoopsModule, $xoopsSecurity;
    $page = rmc_server_var($_REQUEST, 'page', 1);
    $owner = rmc_server_var($_REQUEST, 'owner', 0);
    $uid = rmc_server_var($_REQUEST, 'uid', 0);
    $sort = rmc_server_var($_REQUEST, 'sort', 'created');
    $mode = rmc_server_var($_REQUEST, 'mode', 1);
    $psets = rmc_server_var($_REQUEST, 'albums', array());
    $tags = rmc_server_var($_REQUEST, 'tags', '');
    $ruta = "page={$page}&owner={$owner}&sort={$sort}&mode={$mode}";
    $db = Database::getInstance();
    //Lista de albumes
    $sql = "SELECT * FROM " . $db->prefix('gs_sets') . " WHERE owner='" . ($uid ? $uid : $xoopsUser->uid()) . "' ORDER BY id_set DESC";
    $result = $db->query($sql);
    $sets = array();
    while ($rows = $db->fetchArray($result)) {
        $sets[] = array('id' => $rows['id_set'], 'title' => $rows['title'], 'selected' => in_array($rows['id_set'], $psets));
    }
    $show_controls = false;
    if ($uid > 0 && !empty($sets)) {
        $show_controls = true;
        $uploader = new RMFlashUploader('files-container', '../include/upload.php');
        $uploader->add_setting('scriptData', array('op' => 'savebulk', 'sets' => implode(',', $psets), 'uid' => $uid, 'owner' => $owner, 'sort' => $sort, 'mode' => $mode, 'page' => $page, 'tags' => $tags, 'token' => $xoopsSecurity->createToken(), 'rmsecurity' => TextCleaner::getInstance()->encrypt($xoopsUser->uid() . '|' . GS_URL . '/admin/images.php' . '|' . $xoopsSecurity->createToken(), true)));
        $uploader->add_setting('multi', true);
        $uploader->add_setting('fileExt', '*.jpg;*.png;*.gif;*.JPG');
        $uploader->add_setting('fileDesc', __('All Images (*.jpg, *.png, *.gif)', 'galleries'));
        $uploader->add_setting('sizeLimit', $mc['size_image'] * 1024);
        $uploader->add_setting('buttonText', __('Browse Images...', 'galleries'));
        $uploader->add_setting('queueSizeLimit', 100);
        $uploader->add_setting('onComplete', "function(event, id, file, resp, data){\n                eval('ret = '+resp);\n                if (ret.error){\n                    \$('#upload-errors').append('<span class=\"failed\"><strong>'+file.name+'</strong>: '+ret.message+'</span>');\n                } else {\n                    total++;\n                    ids[total-1] = ret.id;\n                    \$('#upload-errors').append('<span class=\"done\"><strong>'+file.name+'</strong>: " . __('Uploaded successfully!', 'rmcommon') . "</span>');\n                }\n                return true;\n            }");
        $uploader->add_setting('onAllComplete', "function(event, data){\n                \n                if(total<=0){ return; }\n                \n                \$('.select_image_cat').hide('slow');\n                \$('#upload-errors').hide('slow');\n                \$('#upload-errors').html('');\n                \$('#upload-controls').hide('slow');\n                \$('#resizer-bar').show('slow');\n                \$('#resizer-bar').effect('highlight',{},1000);\n                \$('#gen-thumbnails').show();\n                \n                var increments = 1/total*100;\n                url = '" . GS_URL . "/include/upload.php';\n                params = '" . TextCleaner::getInstance()->encrypt($xoopsUser->uid() . '|' . GS_URL . '/admin/images.php' . '|' . $xoopsSecurity->createToken(), true) . "';\n                resize_image(params);\n                \n            }");
        $uploader->add_setting('onError', 'function (event,ID,fileObj,errorObj) {
          alert(errorObj.type + \' Error: \' + errorObj.info);
        }');
        RMTemplate::get()->add_head($uploader->render());
    }
    $form = new RMForm('', 'frmImgs', 'images.php');
    $ele = new RMFormUser('', 'uid', 0, $uid ? array($uid) : array($xoopsUser->uid()), 0);
    $users_field = $ele->render();
    GSFunctions::toolbar();
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . __('Create batch images', 'galleries'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Create batch images', 'galleries'));
    RMTemplate::get()->add_local_script('images.js', 'galleries');
    RMTemplate::get()->add_style('uploader.css', 'galleries');
    xoops_cp_header();
    include RMTemplate::get()->get_template("admin/gs_formimages.php", 'module', 'galleries');
    xoops_cp_footer();
}