<?php if ($user->is_allowed('edit_ashp_activities')) { echo '<h3>Activities</h3>'; $table = 'ashp_activities'; $fields = array('folder', 'title', 'activity_id'); $sort = 'folder'; $order = 'ASC'; $edit = 'activity_id'; $where = ''; echo dashboard_table($table, $fields, $sort, $order, $edit, $where); } if ($user->is_allowed('edit_ashp_faculty')) { echo '<h3>Faculty</h3>'; $table = 'ashp_faculty'; $fields = array('last_name', 'first_name', 'credentials', 'faculty_id'); $sort = 'last_name'; $order = 'ASC'; $edit = 'faculty_id'; $where = ''; echo dashboard_table($table, $fields, $sort, $order, $edit, $where); } ?> </div> </div> </div> <?php include 'footer.php';
</div> <div class="panel-body add-faculty collapse <?php echo $toggle; ?> "> <?php echo faculty_form(); ?> </div> </div> <?php } ?> <?php $table = 'ashp_faculty'; $fields = array('last_name', 'first_name', 'updated', 'faculty_id'); $sort = 'last_name'; $order = 'ASC'; $edit_key = 'faculty_id'; echo dashboard_table($table, $fields, $sort, $order, $edit_key); ?> </div> </div> </div> <?php include 'footer.php';
function activity_content_form($id) { global $user; global $backend; global $mysqli; if (isset($_GET['blast'])) { if (!$user->is_allowed('send_email_blast')) { echo edgimo_error('Your user role is not allowed to send an email blast.'); } else { if ($_GET['blast'] == 'true') { $time = time(); $query = "SELECT reminder_sent FROM ashp_activities WHERE activity_id = {$id} AND reminder_sent = 0"; $result = $mysqli->query($query); if ($mysqli->affected_rows > 0) { send_email_blast($id); $query = "UPDATE ashp_activities SET reminder_sent={$time} WHERE activity_id = {$id}"; $result = $mysqli->query($query); } } if ($_GET['blast'] == 'reset') { echo edgimo_success('Reminder email reset.'); $query = "UPDATE ashp_activities SET reminder_sent=0 WHERE activity_id = {$id}"; $result = $mysqli->query($query); } } unset($_GET['blast']); } if (isset($_POST['template_change'])) { $live_website = $_POST['template_change']; $query = $mysqli->prepare("UPDATE ashp_activities SET live_website=? WHERE activity_id=?"); $query->bind_param('si', $live_website, $id); echo edgimo_success('Template has been changed.'); $query->execute(); $query->close(); } if (isset($_POST['notes_submit'])) { $notes = htmlspecialchars($_POST['notes']); $query = $mysqli->prepare("UPDATE ashp_activities SET notes=? WHERE activity_id=?"); $query->bind_param('si', $notes, $id); echo edgimo_success('Activity notes have been updated.'); $query->execute(); $query->close(); } if (isset($_POST['activity_submit'])) { if (!empty($_FILES)) { $site_folder = get_site_folder($id); foreach ($_FILES['form']['name'] as $file_id => $file_name) { $uploaded_files[$file_id] = $file_name['copy']; } foreach ($_FILES['form']['tmp_name'] as $file_id => $tmp_name) { if ($_FILES['form']['tmp_name'][$file_id]['copy'] != '') { if (move_uploaded_file($_FILES['form']['tmp_name'][$file_id]['copy'], '../' . $site_folder . '/files/' . $uploaded_files[$file_id])) { echo edgimo_success("File uploaded as " . $site_folder . '/files/' . $uploaded_files[$file_id] . "."); $_POST['form'][$file_id]['copy'] = 'files/' . $uploaded_files[$file_id]; } else { echo edgimo_error("Sorry, there was a problem uploading your file."); } } else { $_POST['form'][$file_id]['copy'] = get_activity_copy_by_id($id, $file_id); } } } foreach ($_POST['form'] as $k => $v) { $temp = nl2br($_POST['form'][$k]['copy']); $_POST['form'][$k]['copy'] = $temp; $query = $mysqli->prepare("UPDATE ashp_activity_content SET heading=?, copy=? WHERE field_id=? AND activity_id=?"); $query->bind_param('ssii', $_POST['form'][$k]['heading'], $_POST['form'][$k]['copy'], $k, $id); $query->execute(); $query->close(); } echo edgimo_success('Activity details have been updated.'); } if ($user->is_allowed('edit_ashp_activities')) { $disabled = ''; $submit = ' <div class="form-group"> <button type="submit" class="btn btn-primary" name="activity_submit">Update Activity Copy</button> </div>'; } else { $disabled = 'disabled'; echo edgimo_error('You may view the activity settings, but your user role (' . $user->role . ') is not allowed to make edits.'); $submit = ''; } $activity = new Activity($id); echo ' <h2 class="activity-title">' . $activity->title . '</h2> <form class="form notes_change" method="post"> <label for="notes">Notes For Web Vendor</label> <div class="form-group"> <textarea class="form-control" name="notes">' . $activity->notes . '</textarea> </div> <div class="form-group"><input type="submit" name="notes_submit" value="Update Notes" class="btn btn-xs btn-info"></div> </form> <h3>General Info</h3> <p class="description">Below is the general info about this activity. Click Edit General Info to change information.</p> <p><a href="edit.php?table=activity_settings&id=' . $id . '" class="btn btn-sm btn-info">Edit General Info</a> <a href="' . $activity->url . '" target="_blank" class="btn btn-sm btn-default">View Live Site</a></p> <p class="hidden web-vendor"><a target="_blank" href="http://ashpadvantagemedia.com/' . $activity->folder . '/cheatsheet.php" class="btn btn-sm btn-default">View Cheatsheet</a></p> <table class="table"> <tr> <td>Live Template</td> <td> <form class="form template_change" method="post"> <div class="form-group"> <select class="form-control input-sm" id="template_change" name="template_change">'; foreach ($backend->website_types as $option) { $activity->live_website == $option[0] ? $selected = 'selected' : ($selected = ''); echo '<option ' . $selected . ' value="' . $option[0] . '">' . $option[1] . '</option>'; } echo '</select> </div> </form> </td> </tr> <tr> <td>Sponsor</td> <td>' . $activity->sponsor . '</td> </tr> <tr> <td>Scientific Project Director</td> <td>' . get_user_name($activity->director_id) . '</td> </tr> <tr> <td>Project Manager</td> <td>' . get_user_name($activity->manager_id) . '</td> </tr> <tr> <td>Web Vendor</td> <td>' . get_user_name($activity->vendor_id) . '</td> </tr> </table> <h3>Preview Templates</h3> <p class="description">Click on a template button to preview the site. Dark blue indicates current template.</p>'; foreach ($backend->website_types as $option) { $activity->live_website == $option[0] ? $selected = 'btn-primary' : ($selected = 'btn-info'); echo '<a target="_blank" class="btn ' . $selected . ' btn-sm" href="' . $activity->url . '?preview=' . $option[0] . '">' . $option[1] . '</a> '; } echo ' <hr> <h3 class="toggle">Email List <small>Click to view/hide</small></h3>'; $table = 'ashp_email_list'; $fields = array('last_name', 'first_name', 'email', 'city', 'state', 'submitted'); $sort = 'last_name'; $order = 'ASC'; $edit = false; $where = "WHERE activity_id = {$id}"; $email_list = dashboard_table($table, $fields, $sort, $order, $edit, $where); if ($email_list) { echo '<div class="toggle-target">' . $email_list . '</div>'; echo '<a class="btn btn-success btn-xs" href="edit.php?table=ashp_activities&id=' . $id . '&download=true">Download as CSV</a>'; } else { echo '<p>No email signups yet.</p>'; } echo ' <hr> <h3 class="toggle">Reminder List <small>Click to view/hide</small></h3>'; $table = 'ashp_reminder_list'; $fields = array('name', 'email', 'message', 'submitted'); $sort = 'submitted'; $order = 'ASC'; $edit = false; $where = "WHERE activity_id = {$id}"; $reminder_list = dashboard_table($table, $fields, $sort, $order, $edit, $where); if ($reminder_list) { echo '<div class="toggle-target">' . $reminder_list . '</div>'; if ($activity->reminder_sent == 0) { echo '<p class="text-warning">Reminder has not been sent yet for this activity</p>'; if ($user->is_allowed('send_email_blast')) { echo '<p><a onclick="return confirm(\'This will send a mass email to all email addresses listed in the table. Continue?\');" href="edit.php?table=ashp_activities&id=' . $id . '&blast=true" class="btn btn-warning btn-xs">Send Email Blast</a></p>'; } } else { echo '<p class="text-success">Reminder sent on ' . date('F j, Y', $activity->reminder_sent) . '.</p>'; if ($user->is_allowed('send_email_blast')) { echo '<p><a href="edit.php?table=ashp_activities&id=' . $id . '&blast=reset" class="btn btn-success btn-xs">Reset Email Blast</a></p>'; } } } else { echo '<p>No reminder signups yet.</p>'; } ?> <hr> <h3>Activity Copy</h3> <?php $fields = $activity->get_activity_content(); $fields = $activity->sort_fields($fields); $descriptions = array('general' => 'Information in the general tab is used for the Midyear Symposia pre- and post-pages, MCM webinar registration page, and the On-demand MCM Archive overview page.', 'midyear' => 'Information in the midyear tab is used for the Midyear Symposia pre- and post-pages.', 'virtual' => 'Information in the fields below will be used (as appropriate) on the Midyear Virtual Activity (webinar, webcast) overview page.', 'enduring' => 'Information in the fields below will be used (as appropriate) on the post-Midyear landing page that links to the enduring activities.', 'webinar1' => 'Information in Webinar tab will be used to create webinars not related to the Midyear Activity.', 'webinar2' => 'Information in Webinar tab will be used to create webinars not related to the Midyear Activity.', 'webinar3' => 'Information in Webinar tab will be used to create webinars not related to the Midyear Activity.'); ?> <form enctype="multipart/form-data" class="form" role="form" method="post" id="activity-content-form"> <ul class="nav nav-tabs" role="tablist"> <li class="active"><a href="#general" role="tab" data-toggle="tab">General</a></li> <li><a href="#midyear" role="tab" data-toggle="tab">Midyear</a></li> <li><a href="#enduring" role="tab" data-toggle="tab">Enduring</a></li> <li><a href="#webinar1" role="tab" data-toggle="tab">Webinar 1</a></li> </ul> <div class="tab-content"> <?php foreach ($fields as $tab_group => $value) { $tab_group == 'general' ? $active = 'active' : ($active = ''); echo ' <div class="tab-pane ' . $active . '" id="' . $tab_group . '"> <p class="tab-description">' . $descriptions[$tab_group] . '</p>'; foreach ($fields[$tab_group] as $group_order => $value) { foreach ($fields[$tab_group][$group_order] as $group_name => $value) { echo ' <h3 class="field-group-heading">' . $group_name . '</h3> <div class="field-group">'; foreach ($fields[$tab_group][$group_order][$group_name] as $field_order => $value) { foreach ($fields[$tab_group][$group_order][$group_name][$field_order] as $field) { $has_stock = has_stock_copy($field['field_id']); $using_stock = using_stock_copy($field['field_id'], $id, $activity->type_id, $activity->has_live); $button = ''; $collapse = ''; if ($using_stock) { $button = ' <p class="text-info"><em>This field is using stock copy.</em></p> <p><a class="btn btn-default btn-info btn-xs" data-toggle="collapse" data-target=".collapse-' . $field['field_id'] . '">Customize Stock Copy</a></p>'; $collapse = 'collapse collapse-' . $field['field_id']; } if ($has_stock && !$using_stock) { $button = ' <p class="text-warning"><em>This field is using customized stock copy.</em></p> <p><a class="btn btn-default btn-warning btn-xs revert-stock" data-id="' . $field['field_id'] . '">Revert to Original Stock Copy</a></p>'; $collapse = ''; } echo ' <div class="field-wrap row"> <p class="meta description hidden web-vendor">Field ID: ' . $field['field_id'] . '</p>'; if ($field['heading'] != $group_name) { echo '<h4 class="field-group-subheading">' . $field['heading'] . '</h4>'; } if (in_array($field['field_id'], $backend->editable_headings)) { echo ' <div class="col-lg-12"> <div class="form-group"> <label for="form[' . $field['field_id'] . '][heading]">Heading</label> <input ' . $disabled . ' class="form-control input input-bold" type="text" name="form[' . $field['field_id'] . '][heading]" value="' . $field['heading'] . '"> </div> </div> '; } else { echo '<input type="hidden" ' . $disabled . ' name="form[' . $field['field_id'] . '][heading]" value="' . $field['heading'] . '">'; } if (!$using_stock && $has_stock) { echo ' <div class="hidden-stock" data-id="' . $field['field_id'] . '"> ' . trim(live_options_replace(get_stock_copy($field['field_id']), $activity->has_live)) . ' </div>'; } switch ($field['field_type']) { case 'wysiwyg': if ($using_stock) { echo ' <div class="col-lg-12"> <div class="form-group"> <label for="form[' . $field['field_id'] . '][copy]">Copy</label> <div class="well form-control-static">' . $field['copy'] . '</div> </div> </div> '; } echo ' <div class="col-lg-12"> ' . $button . ' <div class="form-group ' . $collapse . '"> <textarea id="wysiwyg-' . $field['field_id'] . '" ' . $disabled . ' class="wysiwyg" name="form[' . $field['field_id'] . '][copy]">' . $field['copy'] . '</textarea> </div> </div> '; break; case 'textarea': if ($using_stock) { echo ' <div class="col-lg-12"> <div class="form-group"> <label for="form[' . $field['field_id'] . '][copy]">Copy</label> <div class="well form-control-static">' . $field['copy'] . '</div> </div> </div> '; } echo ' <div class="col-lg-12"> ' . $button . ' <div class="form-group ' . $collapse . '"> <textarea class="basic" name="form[' . $field['field_id'] . '][copy]">' . str_replace('<br />', "", $field['copy']) . '</textarea> </div> </div> '; break; case 'text': if ($using_stock) { echo ' <div class="col-lg-8"> <div class="form-group"> <div class="well form-control-static">' . $field['copy'] . '</div> </div> </div> '; } echo ' <div class="col-lg-8"> ' . $button . ' <div class="form-group ' . $collapse . '"> <input id="input-' . $field['field_id'] . '" ' . $disabled . ' class="form-control input-sm" type="text" name="form[' . $field['field_id'] . '][copy]" value="' . $field['copy'] . '"> </div> </div> '; break; case 'date': case 'time': $field['field_type'] == 'date' ? $class = 'date' : ($class = 'time'); $field['field_type'] == 'date' ? $size = 'col-lg-6' : ($size = 'col-lg-3'); echo ' <div class="' . $size . '"> <div class="form-group"> <input ' . $disabled . ' class="form-control input-sm ' . $class . '" name="form[' . $field['field_id'] . '][copy]" value="' . $field['copy'] . '"> </div> </div> '; break; case 'select': echo ' <div class="col-lg-4"> <div class="form-group"> <label for="form[' . $field['field_id'] . '][copy]">Select</label> <select class="form-control" name="form[' . $field['field_id'] . '][copy]">'; echo '<option value="0" selected>-- Choose Faculty Member --</option>'; foreach ($backend->faculty_list as $faculty) { $field['copy'] == $faculty['faculty_id'] ? $selected = 'selected' : ($selected = ''); echo '<option value="' . $faculty['faculty_id'] . '" ' . $selected . '>' . $faculty['faculty_name'] . '</option>'; } echo ' </select> </div> </div> '; break; case 'file': echo ' <div class="col-lg-4"> <div class="form-group"> <input class="form-control" type="file" name="form[' . $field['field_id'] . '][copy]" value="' . $field['copy'] . '"> <p class="form-control-static"> <strong>Currently</strong>: <a href="../' . $activity->folder . '/' . $field['copy'] . '" target="_blank">' . $field['copy'] . '</a> </p> </div> </div>'; break; case 'objectives_intro': $obj_copy = get_stock_copy($field['field_id']); $field['copy'] == $obj_copy ? $knowledge = 'checked' : ($knowledge = ''); $field['copy'] == str_replace('knowledge', 'application', $obj_copy) ? $application = 'checked' : ($application = ''); $application == '' && $knowledge == '' ? $custom = 'checked' : ($custom = ''); echo ' <div class="hidden"> <span id="knowledge-copy">' . $obj_copy . '</span> <span id="application-copy">' . str_replace('knowledge', 'application', $obj_copy) . '</span> </div> <div class="col-lg-8"> <div class="form-group"> <div class="radio-inline"> <label> <input type="radio" name="objectives_intro-' . $field['field_id'] . '" id="knowledge" value="knowledge" ' . $knowledge . '> Knowledge based </label> </div> <div class="radio-inline"> <label> <input type="radio" name="objectives_intro-' . $field['field_id'] . '" id="application" value="application" ' . $application . '> Application based </label> </div> <div class="radio-inline"> <label> <input type="radio" name="objectives_intro-' . $field['field_id'] . '" id="custom" value="custom" ' . $custom . '> Custom </label> </div> </div> </div> <div class="col-lg-8"> <div class="form-group" id="objectives_intro-' . $field['field_id'] . '"> <input id="input-' . $field['field_id'] . '" class="form-control input-sm" type="text" name="form[' . $field['field_id'] . '][copy]" value="' . $field['copy'] . '"> </div> </div> '; break; } echo ' </div>'; } } echo '</div>'; } } echo ' </div>'; } ?> </div> <?php /* $first = ''; $section_toggle = 'hook-midyear'; foreach( $backend->groups as $group_name => $group_field_id ){ $heading_displayed = false; foreach( $fields as $field ){ if ( !in_array($field['field_id'], $backend->groups[$group_name]) ){ continue; } $has_stock = has_stock_copy( $field['field_id'] ); $using_stock = using_stock_copy( $field['field_id'], $id, $activity->type_id, $activity->has_live ); $button = ''; $collapse = ''; if ( $using_stock ){ $button = ' <p class="text-info"><em>This field is using stock copy.</em></p> <p><a class="btn btn-default btn-info btn-xs" data-toggle="collapse" data-target=".collapse-'.$field['field_id'].'">Customize Stock Copy</a></p>'; $collapse = 'collapse collapse-'.$field['field_id']; } if ( $has_stock && !$using_stock){ $button = ' <p class="text-warning"><em>This field is using customized stock copy.</em></p> <p><a class="btn btn-default btn-warning btn-xs revert-stock" data-id="'.$field['field_id'].'">Revert to Original Stock Copy</a></p>'; $collapse = ''; } if ( $group_name == 'Enduring Summary Statement' ){ $section_toggle = 'hook-enduring'; } if ( !$heading_displayed ){ echo $first . '<h3 class="field-group-heading '.$section_toggle.'">'.$group_name.'</h3> <div class="field-group '.$section_toggle.'">'; $heading_displayed = true; $first = '</div>'; } echo ' <div class="field-wrap row"> <p class="meta description hidden web-vendor">Field ID: '.$field['field_id'].'</p>'; if ( $field['heading'] != $group_name ){ echo '<h4 class="field-group-subheading">'.$field['heading'].'</h4>'; } if ( in_array($field['field_id'], $backend->editable_headings) ){ echo' <div class="col-lg-12"> <div class="form-group"> <label for="form['.$field['field_id'].'][heading]">Heading</label> <input '.$disabled.' class="form-control input input-bold" type="text" name="form['.$field['field_id'].'][heading]" value="'.$field['heading'].'"> </div> </div> '; } else{ echo '<input type="hidden" '.$disabled.' name="form['.$field['field_id'].'][heading]" value="'.$field['heading'].'">'; } if ( !$using_stock && $has_stock ){ echo ' <div class="hidden-stock" data-id="'.$field['field_id'].'"> '.trim( live_options_replace( get_stock_copy($field['field_id']), $activity->has_live ) ).' </div>'; } switch ( $field['field_type'] ){ case 'wysiwyg' : if ( $using_stock ){ echo ' <div class="col-lg-12"> <div class="form-group"> <label for="form['.$field['field_id'].'][copy]">Copy</label> <div class="well form-control-static">'.$field['copy'].'</div> </div> </div> '; } echo ' <div class="col-lg-12"> '.$button.' <div class="form-group '.$collapse.'"> <textarea id="wysiwyg-'.$field['field_id'].'" '.$disabled.' class="wysiwyg" name="form['.$field['field_id'].'][copy]">'.$field['copy'].'</textarea> </div> </div> '; break; case 'textarea' : if ( $using_stock ){ echo ' <div class="col-lg-12"> <div class="form-group"> <label for="form['.$field['field_id'].'][copy]">Copy</label> <div class="well form-control-static">'.$field['copy'].'</div> </div> </div> '; } echo ' <div class="col-lg-12"> '.$button.' <div class="form-group '.$collapse.'"> <textarea class="basic" name="form['.$field['field_id'].'][copy]">'.str_replace('<br />',"",$field['copy']).'</textarea> </div> </div> '; break; case 'text' : if ( $using_stock ){ echo ' <div class="col-lg-8"> <div class="form-group"> <div class="well form-control-static">'.$field['copy'].'</div> </div> </div> '; } echo ' <div class="col-lg-8"> '.$button.' <div class="form-group '.$collapse.'"> <input id="input-'.$field['field_id'].'" '.$disabled.' class="form-control input-sm" type="text" name="form['.$field['field_id'].'][copy]" value="'.$field['copy'].'"> </div> </div> '; break; case 'date' : case 'time' : $field['field_type'] == 'date' ? $class = 'date' : $class = 'time'; $field['field_type'] == 'date' ? $size = 'col-lg-6' : $size = 'col-lg-3'; echo ' <div class="'.$size.'"> <div class="form-group"> <input '.$disabled.' class="form-control input-sm '.$class.'" name="form['.$field['field_id'].'][copy]" value="'.$field['copy'].'"> </div> </div> '; break; case 'select' : echo ' <div class="col-lg-4"> <div class="form-group"> <label for="form['.$field['field_id'].'][copy]">Select</label> <select class="form-control" name="form['.$field['field_id'].'][copy]">'; echo '<option value="0" selected>-- Choose Faculty Member --</option>'; foreach ($backend->faculty_list as $faculty) { $field['copy'] == $faculty['faculty_id'] ? $selected = 'selected' : $selected = ''; echo '<option value="'.$faculty['faculty_id'].'" '.$selected.'>'.$faculty['faculty_name'].'</option>'; } echo' </select> </div> </div> '; break; case 'file' : echo ' <div class="col-lg-4"> <div class="form-group"> <input class="form-control" type="file" name="form['.$field['field_id'].'][copy]" value="'.$field['copy'].'"> <p class="form-control-static"> <strong>Currently</strong>: <a href="../' . $activity->folder . '/' . $field['copy'] .'" target="_blank">'.$field['copy'].'</a> </p> </div> </div>'; break; case 'objectives_intro' : $obj_copy = get_stock_copy( $field['field_id'] ); $field['copy'] == $obj_copy ? $knowledge = 'checked' : $knowledge = ''; $field['copy'] == str_replace('knowledge', 'application', $obj_copy ) ? $application = 'checked' : $application = ''; $application == '' && $knowledge == '' ? $custom = 'checked' : $custom = ''; echo ' <div class="hidden"> <span id="knowledge-copy">'.$obj_copy.'</span> <span id="application-copy">'.str_replace('knowledge', 'application', $obj_copy ).'</span> </div> <div class="col-lg-8"> <div class="form-group"> <div class="radio-inline"> <label> <input type="radio" name="objectives_intro" id="knowledge" value="knowledge" '.$knowledge.'> Knowledge based </label> </div> <div class="radio-inline"> <label> <input type="radio" name="objectives_intro" id="application" value="application" '.$application.'> Application based </label> </div> <div class="radio-inline"> <label> <input type="radio" name="objectives_intro" id="custom" value="custom" '.$custom.'> Custom </label> </div> </div> </div> <div class="col-lg-8"> <div class="form-group" id="objectives_intro"> <input id="input-'.$field['field_id'].'" class="form-control input-sm" type="text" name="form['.$field['field_id'].'][copy]" value="'.$field['copy'].'"> </div> </div> '; break; } echo ' </div>'; } } */ echo '<hr>'; echo $submit; echo '</form>'; }