예제 #1
0
    /**
     * Shows a form to add an event
     *  will default to the current date if non is provided
     * @return 
     */
    function EditEventForm()
    {
        $db =& $this->db;
        $user =& $this->user;
        $response = new ResponseManager();
        $eventID = Kit::GetParam('EventID', _GET, _INT, 0);
        $eventDetailID = Kit::GetParam('EventDetailID', _GET, _INT, 0);
        if ($eventID == 0) {
            trigger_error('No event selected.', E_USER_ERROR);
        }
        // Get the relevant details for this event
        $SQL = "";
        $SQL .= "SELECT schedule.FromDT, ";
        $SQL .= "       schedule.ToDT,";
        $SQL .= "       schedule.CampaignID, ";
        $SQL .= "       schedule.userid, ";
        $SQL .= "       schedule.is_priority, ";
        $SQL .= "       schedule.DisplayGroupIDs, ";
        $SQL .= "       schedule.recurrence_type, ";
        $SQL .= "       schedule.recurrence_detail, ";
        $SQL .= "       schedule.recurrence_range, ";
        $SQL .= "       schedule.EventID, ";
        $SQL .= "       schedule_detail.DisplayOrder ";
        $SQL .= "  FROM schedule ";
        $SQL .= "  INNER JOIN schedule_detail ON schedule.EventID = schedule_detail.EventID ";
        $SQL .= " WHERE 1=1 ";
        $SQL .= sprintf("   AND schedule.EventID = %d", $eventID);
        $SQL .= sprintf("   AND schedule_detail.schedule_detailID = %d", $eventDetailID);
        Debug::LogEntry('audit', $SQL);
        if (!($result = $db->query($SQL))) {
            trigger_error($db->error());
            trigger_error(__('Error getting details for this event.'), E_USER_ERROR);
        }
        $row = $db->get_assoc_row($result);
        $fromDT = Kit::ValidateParam($row['FromDT'], _INT);
        $toDT = Kit::ValidateParam($row['ToDT'], _INT);
        $displayGroupIds = explode(',', Kit::ValidateParam($row['DisplayGroupIDs'], _STRING));
        $recType = Kit::ValidateParam($row['recurrence_type'], _STRING);
        $recDetail = Kit::ValidateParam($row['recurrence_detail'], _STRING);
        $recToDT = Kit::ValidateParam($row['recurrence_range'], _STRING);
        $campaignId = Kit::ValidateParam($row['CampaignID'], _STRING);
        $isPriority = Kit::ValidateParam($row['is_priority'], _CHECKBOX) == 1 ? 'checked' : '';
        $displayOrder = Kit::ValidateParam($row['DisplayOrder'], _INT);
        $fromDtText = date("d/m/Y H:i", $fromDT);
        $toDtText = date("d/m/Y H:i", $toDT);
        $recToDtText = '';
        $recToTimeText = '';
        if ($recType != '') {
            $recToDtText = date("d/m/Y H:i", $recToDT);
        }
        // Check that we have permission to edit this event.
        if (!$this->IsEventEditable($displayGroupIds)) {
            trigger_error(__('You do not have permission to edit this event.'), E_USER_ERROR);
        }
        // Filter forms for selecting layouts and displays
        $layoutFilter = $this->EventFormLayoutFilter($campaignId);
        $displayFilter = $this->EventFormDisplayFilter($displayGroupIds);
        $token = Kit::Token();
        $form = <<<END
<div class="container-fluid">
<div class="row-fluid">
    <div class="span6">
        {$layoutFilter}
    </div>
    <div class="span6">
        {$displayFilter}
    </div>
</div>
<div class="row-fluid">
    <div class="span12">
<form id="EditEventForm" class="XiboScheduleForm" action="index.php?p=schedule&q=EditEvent" method="post">
    {$token}
    <input type="hidden" id="EventID" name="EventID" value="{$eventID}" />
    <input type="hidden" id="EventDetailID" name="EventDetailID" value="{$eventDetailID}" />
    <table style="width:100%;">
        <tr>
            <td colspan="4"><center><h3>Event Schedule</h3></center></td>
        </tr>
        <tr>
            <td><label for="starttime" title="Select the start time for this event">Start Time</label></td>
            <td>
                <div class="date-pick input-append date">
                    <input data-format="dd/MM/yyyy hh:mm" type="text" class="input-medium" name="starttime" id="starttime" value="{$fromDtText}"></input>
                    <span class="add-on">
                        <i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
                    </span>
                </div>
            </td>
            <td><label for="endtime" title="Select the end time for this event">End Time</label></td>
            <td>
                <div class="date-pick input-append date">
                    <input data-format="dd/MM/yyyy hh:mm" type="text" class="input-medium" name="endtime" id="endtime" value="{$toDtText}"></input>
                    <span class="add-on">
                        <i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
                    </span>
                </div>
            </td>
        </tr>
        <tr>
            <td><label for="DisplayOrder" title="Select the Order for this Event">Display Order</label></td>
            <td><input type=text" name="DisplayOrder" value="{$displayOrder}" />
            <td><label title="Sets whether or not this event has priority. If set the event will be show in preference to other events." for="cb_is_priority">Priority</label></td>
            <td><input type="checkbox" id="cb_is_priority" name="is_priority" {$isPriority} title="Sets whether or not this event has priority. If set the event will be show in preference to other events."></td>
        </tr>
END;
        //recurrance part of the form
        $rec_type = listcontent("null|None,Hour|Hourly,Day|Daily,Week|Weekly,Month|Monthly,Year|Yearly", "rec_type", $recType);
        $form .= <<<END
        <tr>
            <td colspan="4"><center><h3>Recurring Event</h3></center></td>
        </tr>
        <tr>
            <td><label for="rec_type" title="What type of repeating is required">Repeats</label></td>
            <td>{$rec_type}</td>
            <td><label for="rec_detail" title="How often does this event repeat">Repeat every</label></td>
            <td><input class="number" type="text" name="rec_detail" value="{$recDetail}" /></td>
        </tr>
        <tr>
            <td><label for="rec_range" title="When should this event stop repeating?">Until</label></td>
            <td><div class="date-pick input-append date">
                <input data-format="dd/MM/yyyy hh:mm" type="text" class="input-medium" name="rec_range" id="rec_range" value="{$recToDtText}"></input>
                <span class="add-on">
                    <i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
                </span>
            </div></td>
        </tr>
END;
        $form .= <<<END
        </table>
    </form>
    </div>
</div>
</div>
END;
        $response->SetFormRequestResponse($form, __('Edit Event'), '800px', '600px');
        $response->AddButton(__('Help'), "XiboHelpRender('index.php?p=help&q=Display&Topic=Schedule&Category=Edit')");
        $response->AddButton(__('Delete'), 'XiboFormRender("index.php?p=schedule&q=DeleteForm&EventID=' . $eventID . '")');
        $response->AddButton(__('Cancel'), 'XiboDialogClose()');
        $response->AddButton(__('Save'), '$("#EditEventForm").attr("action", $("#EditEventForm").attr("action") + "&next=0").submit()');
        $response->callBack = 'setupScheduleForm';
        $response->dialogClass = 'modal-big';
        $response->Respond();
    }
예제 #2
0
    /**
     * Return the Delete Form as HTML
     * @return
     */
    public function DeleteForm()
    {
        $db =& $this->db;
        $helpManager = new HelpManager($db, $this->user);
        $this->response = new ResponseManager();
        $this->response->AddButton(__('Help'), 'XiboHelpRender("' . $helpManager->Link('Media', 'Delete') . '")');
        //Parameters
        $layoutid = $this->layoutid;
        $regionid = $this->regionid;
        $mediaid = $this->mediaid;
        $lkid = $this->lkid;
        $userid = $this->user->userid;
        // Can this user delete?
        if (!$this->auth->del) {
            $this->response->SetError('You do not have permission to delete this media.');
            $this->response->keepOpen = false;
            return $this->response;
        }
        // Messages
        $msgTitle = __('Return to the Region Options');
        $msgWarn = __('Are you sure you want to remove this item?');
        $msgWarnLost = __('It will be lost');
        $msgYes = __('Yes');
        $msgNo = __('No');
        if ($this->regionSpecific) {
            $form = <<<END
                <form id="MediaDeleteForm" class="XiboForm" method="post" action="index.php?p=module&mod={$this->type}&q=Exec&method=DeleteMedia">
                        <input type="hidden" name="mediaid" value="{$mediaid}">
                        <input type="hidden" name="layoutid" value="{$layoutid}">
                        <input type="hidden" name="regionid" value="{$regionid}">
                        <p>{$msgWarn} <span class="required">{$msgWarnLost}</span>.</p>
                </form>
END;
            $this->response->AddButton(__('No'), 'XiboFormRender("index.php?p=timeline&layoutid=' . $layoutid . '&regionid=' . $regionid . '&q=RegionOptions")');
            $this->response->AddButton(__('Yes'), '$("#MediaDeleteForm").submit()');
        } else {
            // This is for library based media
            $options = '';
            // Get the permissions for the media item
            $mediaAuth = $this->user->MediaAuth($mediaid, true);
            // Is this user allowed to delete this media?
            if ($mediaAuth->del) {
                // Load what we know about this media into the object
                $SQL = "SELECT IFNULL(editedMediaID, 0) AS editedMediaID FROM media WHERE mediaID = {$mediaid} ";
                $editedMediaID = $db->GetSingleValue($SQL, 'editedMediaID', _INT);
                if ($editedMediaID === false) {
                    trigger_error($editedMediaID . $db->error());
                    $this->response->SetError(__('Error querying for the Media information'));
                    $this->response->keepOpen = true;
                    return $this->response;
                }
                // Is this media retired?
                $revised = false;
                if ($editedMediaID != 0) {
                    $revised = true;
                }
                // Is this media being used anywhere else?
                if ($layoutid == '') {
                    $SQL = sprintf('SELECT layoutID FROM lklayoutmedia WHERE mediaID = %d ', $mediaid);
                    $options = '';
                } else {
                    $SQL = sprintf("SELECT layoutID FROM lklayoutmedia WHERE mediaID = %d AND layoutid <> %d AND regionID <> '%s' ", $mediaid, $layoutid, $regionid);
                }
                if (!($results = $db->query($SQL))) {
                    trigger_error($db->error());
                    $this->response->SetError(__('Cannot determine if this media has been used.'));
                    $this->response->keepOpen = true;
                    return $this->response;
                }
                if ($db->num_rows($results) == 0 && !$revised) {
                    $options .= ',delete|' . __('Delete this media');
                } else {
                    $options .= ',retire|' . __('Retire this media');
                    $options .= ',unassignall|' . __('Unassign from all Layouts');
                }
                $options .= ',retire|' . __('Unassign from this region and retire');
            } else {
                // If this is the normal content page then say they cant edit, otherwise display the form with only the unassign option
                if ($layoutid == '') {
                    $this->response->SetError(__('You do not have permission to alter/delete this media.'));
                    $this->response->keepOpen = true;
                    return $this->response;
                }
            }
            // Always have the abilty to unassign from the region
            $options .= ',unassign|' . __('Unassign from this region only');
            $options = ltrim($options, ',');
            $deleteOptions = listcontent($options, 'options');
            $msgWarn = __('Are you sure you want to delete this media?');
            $msgSelect = __('Please select from the following options');
            $msgCaution = __('Deleting media cannot be undone');
            //we can delete
            $form = <<<END
                <form id="MediaDeleteForm" class="XiboForm" method="post" action="index.php?p=module&mod={$this->type}&q=Exec&method=DeleteMedia">
                    <input type="hidden" name="mediaid" value="{$mediaid}">
                    <input type="hidden" name="lkid" value="{$lkid}">
                    <input type="hidden" name="layoutid" value="{$layoutid}">
                    <input type="hidden" name="regionid" value="{$regionid}">
                    <p>{$msgWarn}</p>
                    <p>{$msgSelect}: {$deleteOptions} </p>
                    <p>{$msgCaution}</p>
                </form>
END;
            if ($layoutid == '') {
                $this->response->AddButton(__('No'), 'XiboDialogClose()');
            } else {
                $this->response->AddButton(__('No'), 'XiboFormRender("index.php?p=timeline&layoutid=' . $layoutid . '&regionid=' . $regionid . '&q=RegionOptions")');
            }
            $this->response->AddButton(__('Yes'), '$("#MediaDeleteForm").submit()');
        }
        $this->response->html = $form;
        $this->response->dialogTitle = __('Delete Media');
        $this->response->dialogSize = true;
        $this->response->dialogWidth = '450px';
        $this->response->dialogHeight = '280px';
        return $this->response;
    }
예제 #3
0
파일: js.php 프로젝트: xubo245/liuyangzhang
        }
        $_INDEX = " USE INDEX ( list ) ";
        $ORDER = ' list ';
    }
    $SQL = " {$_INDEX} WHERE {$SQL} AND yz=1 ORDER BY {$ORDER} DESC LIMIT {$rows}";
    $which = '*';
    $_target = $target ? '_blank' : '_self';
    if ($path) {
        $_path = preg_replace("/(.*)\\/([^\\/]+)/is", "\\1/", $WEBURL);
    }
    if ($icon == 1) {
        $_icon = "·";
    } else {
        $_icon = "&nbsp;";
    }
    $listdb = listcontent($SQL, $which, $leng);
    foreach ($listdb as $key => $rs) {
        $show .= "{$_icon}<A target='{$_target}' HREF='{$_path}bencandy.php?fid={$rs['fid']}&id={$rs['id']}' title='{$rs['full_title']}'>{$rs['title']}</A><br>";
    }
    if (!$show) {
        $show = "暂无...";
    }
    $show = str_Replace("'", '"', $show);
    $show = str_Replace("\r", '', $show);
    $show = str_Replace("\n", '', $show);
    $show = "document.write('{$show}');";
    echo $show;
} elseif ($type == 'sonfid') {
    $fid && ($rs = $db->get_one("SELECT fup FROM {$_pre}sort WHERE fid='{$fid}'"));
    $show = get_fidsNames($rs[fup], $cType, $rows, $class ? $class : 3);
    if (!$show) {