예제 #1
0
            $fillFields['category_langs'][$category_lang->locale] = array('category_title' => $category_lang->category_title, 'category_description' => $category_lang->category_description);
        }
        ?>
											<tr id="<?php 
        echo $category_id;
        ?>
">
												<td class="col-1 col-drag-handle">&nbsp;</td>
												<td class="col-2_sub">
													<div class="post">
														<h4><?php 
        echo html::escape($category_title);
        ?>
</h4>
														<p><?php 
        echo html::escape($category_description);
        ?>
...</p>
													</div>
												</td>
												<td class="col-3">
												<?php 
        if (!empty($category_image)) {
            echo "<img src=\"" . $category_image . "\">";
            echo "&nbsp;[<a href=\"javascript:catAction('i','DELETE ICON','" . rawurlencode($category_id) . "')\">delete</a>]";
        } else {
            echo "<span class=\"swatch\" style=\"background-color: #" . $category_color . ";\">&nbsp;</span>";
        }
        ?>
												</td>
												<td class="col-4">
예제 #2
0
 /**
  * Get categories as an tree array
  * @param bool Get category count?
  * @param bool Include hidden categories
  * @return array
  **/
 public static function get_category_tree_data($count = FALSE, $include_hidden = FALSE)
 {
     // To hold the category data
     $category_data = array();
     // Database table prefix
     $table_prefix = Kohana::config('database.default.table_prefix');
     // Database instance
     $db = new Database();
     // Fetch the other categories
     if ($count) {
         $sql = "SELECT c.id, c.parent_id, c.category_title, c.category_color, c.category_image, c.category_image_thumb, COUNT(i.id) report_count " . "FROM " . $table_prefix . "category c " . "LEFT JOIN " . $table_prefix . "category c_parent ON (c.parent_id = c_parent.id) " . "LEFT JOIN " . $table_prefix . "incident_category ic ON (ic.category_id = c.id) " . "LEFT JOIN " . $table_prefix . "incident i ON (ic.incident_id = i.id AND i.incident_active = 1 ) " . "WHERE 1=1 " . (!$include_hidden ? "AND c.category_visible = 1 " : "") . (!$include_hidden ? "AND (c_parent.category_visible = 1 OR c.parent_id = 0)" : "") . "GROUP BY c.id " . "ORDER BY c.category_position ASC";
     } else {
         $sql = "SELECT c.id, c.parent_id, c.category_title, c.category_color, c.category_image, c.category_image_thumb " . "FROM " . $table_prefix . "category c " . "LEFT JOIN " . $table_prefix . "category c_parent ON (c.parent_id = c_parent.id) " . "WHERE 1=1 " . (!$include_hidden ? "AND c.category_visible = 1 " : "") . (!$include_hidden ? "AND (c_parent.category_visible = 1 OR c.parent_id = 0)" : "") . "ORDER BY c.category_position ASC";
     }
     // Create nested array - all in one pass
     foreach ($db->query($sql) as $category) {
         // If we didn't fetch report_count set fake value
         if (!$count) {
             $category->report_count = 0;
         }
         // If this is a parent category, just add it to the array
         if ($category->parent_id == 0) {
             // save children and report_count if already been created.
             $children = isset($category_data[$category->id]['children']) ? $category_data[$category->id]['children'] : array();
             $report_count = isset($category_data[$category->id]['report_count']) ? $category_data[$category->id]['report_count'] : 0;
             $category_data[$category->id] = array('category_id' => $category->id, 'category_title' => html::escape(Category_Lang_Model::category_title($category->id)), 'category_description' => html::escape(Category_Lang_Model::category_description($category->id)), 'category_color' => $category->category_color, 'category_image' => $category->category_image, 'children' => $children, 'category_image_thumb' => $category->category_image_thumb, 'parent_id' => $category->parent_id, 'report_count' => $category->report_count + $report_count);
         } else {
             // If we haven't processed the parent yet, add placeholder parent category
             if (!array_key_exists($category->parent_id, $category_data)) {
                 $category_data[$category->parent_id] = array('category_id' => $category->parent_id, 'category_title' => '', 'category_description' => '', 'parent_id' => 0, 'category_color' => '', 'category_image' => '', 'category_image_thumb' => '', 'children' => array(), 'report_count' => 0);
             }
             // Add children
             $category_data[$category->parent_id]['children'][$category->id] = array('category_id' => $category->id, 'category_title' => html::escape(Category_Lang_Model::category_title($category->id)), 'category_description' => html::escape(Category_Lang_Model::category_description($category->id)), 'parent_id' => $category->parent_id, 'category_color' => $category->category_color, 'category_image' => $category->category_image, 'category_image_thumb' => $category->category_image_thumb, 'report_count' => $category->report_count, 'children' => array());
             // Add to parent report count too
             $category_data[$category->parent_id]['report_count'] += $category->report_count;
         }
     }
     return $category_data;
 }
예제 #3
0
    /**
     * Generates the JavaScript for stats tracking
     */
    public static function get_javascript()
    {
        // Make sure cURL is installed
        if (!function_exists('curl_exec')) {
            throw new Kohana_Exception('footer.cURL_not_installed');
            return false;
        }
        // Get the stat id
        $stat_id = Settings_Model::get_setting('stat_id');
        // If stats isn't set, ignore this
        if ($stat_id == 0) {
            return '';
        }
        $cache = Cache::instance();
        $tag = $cache->get(Kohana::config('settings.subdomain') . '_piwiktag');
        if (!$tag) {
            // Cache is Empty so Re-Cache
            // Grabbing the URL to update stats URL, Name, Reports, etc on the stats server
            $additional_query = '';
            if (isset($_SERVER["HTTP_HOST"])) {
                // Grab the site domain from the config and trim any whitespaces
                $site_domain = trim(Kohana::config('config.site_domain'));
                $slashornoslash = '';
                if (empty($site_domain) or $site_domain[0] != '/') {
                    $slashornoslash = '/';
                }
                // URL
                $val = url::base();
                $additional_query = '&val=' . base64_encode($val);
                // Site Name
                $site_name = html::escape(Kohana::config('settings.site_name'));
                $additional_query .= '&sitename=' . base64_encode($site_name);
                // Version
                $version = Kohana::config('settings.ushahidi_version');
                $additional_query .= '&version=' . base64_encode($version);
                // Report Count
                $number_reports = ORM::factory("incident")->where("incident_active", 1)->count_all();
                $additional_query .= '&reports=' . base64_encode($number_reports);
                // Latitude
                $latitude = Kohana::config('settings.default_lat');
                $additional_query .= '&lat=' . base64_encode($latitude);
                // Longitude
                $longitude = Kohana::config('settings.default_lon');
                $additional_query .= '&lon=' . base64_encode($longitude);
            }
            $url = Kohana::config('config.external_site_protocol') . '://tracker.ushahidi.com/dev.px.php?task=tc&siteid=' . $stat_id . $additional_query;
            $request = new HttpClient($url);
            $buffer = $request->execute();
            try {
                // This works because the tracking code is only wrapped in one tag
                $tag = (string) @simplexml_load_string($buffer);
            } catch (Exception $e) {
                // In case the xml was malformed for whatever reason, we will just guess what the tag should be here
                $tag = <<<STATSCOLLECTOR
\t\t\t\t\t<!-- Stats Collector -->
\t\t\t\t\t<script type="text/javascript">
\t\t\t\t\tsetTimeout(function() {
\t\t\t\t\t\tvar statsCollector = document.createElement('img');
\t\t\t\t\t\t    statsCollector.src = document.location.protocol + "//tracker.ushahidi.com/piwik/piwik.php?idsite={$stat_id}&rec=1";
\t\t\t\t\t\t    statsCollector.style.cssText = "width: 1px; height: 1px; opacity: 0.1;";

\t\t\t\t\t\tdocument.body.appendChild(statsCollector);
\t\t\t\t\t}, 100);
\t\t\t\t\t</script>
\t\t\t\t\t<!-- End Stats Collector -->
STATSCOLLECTOR;
            }
            // Reset Cache Here
            $cache->set(Kohana::config('settings.subdomain') . '_piwiktag', $tag, array('piwiktag'), 86400);
            // 1 Day
        }
        return $tag;
    }
예제 #4
0
    ?>
</strong>
											<br/><a href="<?php 
    echo $app->url;
    ?>
"><?php 
    echo $app->url;
    ?>
</a>

										</td>
										<td class="col-4" style="width:120px;">

											<ul>
												<li><a href="javascript:appAction('d','<?php 
    echo utf8::strtoupper(html::escape(Kohana::lang('ui_main.remove') . ' ' . $app->name));
    ?>
','<?php 
    echo rawurlencode($app->id);
    ?>
')" class="del"><?php 
    echo Kohana::lang('ui_main.remove');
    ?>
</a></li>
											</ul>

										</td>
									</tr>
							<?php 
}
?>
예제 #5
0
					<h4><?php 
echo Kohana::lang('ui_main.reports_by_this_user');
?>
</h4>
					<?php 
foreach ($reports as $report) {
    ?>
						<div class="rb_report">
							<h5><a href="<?php 
    echo url::site();
    ?>
reports/view/<?php 
    echo $report->id;
    ?>
"><?php 
    echo html::escape($report->incident_title);
    ?>
</a></h5>
							<p class="r_date r-3 bottom-cap"><?php 
    echo date('H:i M d, Y', strtotime($report->incident_date));
    ?>
</p>
							<p class="r_location"><?php 
    echo html::specialchars($report->location->location_name);
    ?>
</p>
						</div>
					<?php 
}
?>
				</div>
예제 #6
0
"><?php 
echo Kohana::lang('ui_admin.mark_as');
?>
:</a></h4>
								<?php 
echo form::radio('action_approve', '0', TRUE) . ' ' . Kohana::lang('ui_main.disapprove');
?>
<br/>
								<?php 
echo form::radio('action_approve', '1', FALSE) . ' ' . Kohana::lang('ui_main.approve');
?>
							</div>

							<div class="tab_form_item" id="action_form_badge" style="margin-right:75px;">
								<h4><a href="#" class="tooltip" title="<?php 
echo html::escape(Kohana::lang("tooltips.actions.assign_badge"));
?>
"><?php 
echo Kohana::lang('ui_admin.assign_badge');
?>
:</a></h4>
								<?php 
echo form::dropdown('action_badge', $badges);
?>
							</div>

						</div>

						<div style="clear:both"></div>

						<div class="tab_form_item">
예제 #7
0
    $incident_id = $incident->id;
    $incident_title = text::limit_chars(html::strip_tags($incident->incident_title), 40, '...', True);
    $incident_date = $incident->incident_date;
    $incident_date = date('M j Y', strtotime($incident->incident_date));
    $incident_location = $incident->location->location_name;
    ?>
		<tr>
			<td><a href="<?php 
    echo url::site() . 'reports/view/' . $incident_id;
    ?>
"> <?php 
    echo $incident_title;
    ?>
</a></td>
			<td><?php 
    echo html::escape($incident_location);
    ?>
</td>
			<td><?php 
    echo $incident_date;
    ?>
</td>
		</tr>
		<?php 
}
?>
	</tbody>
</table>
<a class="more" href="<?php 
echo url::site() . 'reports/';
?>
예제 #8
0
?>
</a></li>
								<li><a href="<?php 
echo url::site();
?>
feeds" class="rss-icon"><?php 
echo Kohana::lang('ui_main.rss');
?>
</a></li>
							</ul>
						</div>
						<?php 
foreach ($feeds as $feed) {
    $feed_id = $feed->id;
    $feed_title = $feed->item_title;
    $feed_description = text::limit_chars(html::escape($feed->item_description), 150, '...', True);
    $feed_link = $feed->item_link;
    $feed_date = date('M j Y', strtotime($feed->item_date));
    $feed_source = "NEWS";
    ?>
							<div class="post">
								<h4><a href="<?php 
    echo $feed_link;
    ?>
" target="_blank"><?php 
    echo $feed_title;
    ?>
</a></h4>
								<em class="date"><?php 
    echo $feed_source;
    ?>
    echo url::site() . 'reports/view/' . $incident_id;
    ?>
"> <?php 
    echo $incident_title;
    ?>
</a></td>
			<td><?php 
    echo html::escape($how_feel);
    ?>
</td>
			<td><?php 
    echo html::escape($why_feel);
    ?>
</td>
			<td><?php 
    echo html::escape($change_place);
    ?>
</td>
			<td><?php 
    if (!$incident_image) {
        ?>
No Image.<?php 
    } else {
        ?>
<img src="<?php 
        echo $incident_image;
        ?>
" style="max-width:100px;"><?php 
    }
    ?>
</td>
예제 #10
0
										</tr>
									<?php 
}
foreach ($pages as $page) {
    $page_id = $page->id;
    $page_title = $page->page_title;
    $page_tab = $page->page_tab;
    $page_description = $page->page_description;
    $page_active = $page->page_active;
    ?>
										<tr>
											<td class="col-1">&nbsp;</td>
											<td class="col-2">
												<div class="post">
													<h4><?php 
    echo html::escape($page_title);
    ?>
</h4>
													<p><?php 
    echo text::limit_chars(html::strip_tags($page_description), "100", "...");
    ?>
</p>
												</div>
											</td>
											
											<td class="col-4">
												<ul>
													<li class="none-separator"><a href="#add" onClick="fillFields(
	'<?php 
    echo rawurlencode($page_id);
    ?>
예제 #11
0
파일: php.php 프로젝트: xpd1437/swap
 public static function set($key, $value)
 {
     self::$primary[$key] = $value;
     self::$escaped[$key] = html::escape($value);
 }
예제 #12
0
파일: router.php 프로젝트: xpd1437/swap
 public function html_escape()
 {
     $that = clone $this;
     $that->params = html::escape($that->params);
     return $that;
 }
예제 #13
0
													<?php 
    } else {
        ?>
													<a href="javascript:sharingAction('v','SHOW',<?php 
        echo html::escape($site_id);
        ?>
)" class="status_yes"><?php 
        echo Kohana::lang('ui_main.hidden');
        ?>
</a>
													<?php 
    }
    ?>
													</li>
<li><a href="javascript:sharingAction('d','DELETE','<?php 
    echo html::escape($site_id);
    ?>
')" class="del"><?php 
    echo Kohana::lang('ui_main.delete');
    ?>
</a></li>
												</ul>
											</td>
										</tr>
										<?php 
}
?>
								</tbody>
							</table>
						</div>
					<?php 
예제 #14
0
 /**
  * Get messages according to a search criteria
  *
  * @param	string	search criteria (RFC2060, sec. 6.4.4). Set to "UNSEEN" by default
  *					NB: Search criteria only affects IMAP mailboxes.
  * @param	string	date format. Set to "Y-m-d H:i:s" by default
  * @return	mixed	array containing messages
  */
 public function get_messages($search_criteria = "UNSEEN", $date_format = "Y-m-d H:i:s")
 {
     global $htmlmsg, $plainmsg, $attachments;
     // If our imap connection failed earlier, return no messages
     if ($this->imap_stream == false) {
         return array();
     }
     // Use imap_search() to find the 'UNSEEN' messages.
     // This is more efficient than previous code using imap_num_msg()
     $new_msgs = imap_search($this->imap_stream, 'UNSEEN');
     $max_imap_messages = Kohana::config('email.max_imap_messages');
     if ($new_msgs == null) {
         return array();
     }
     // Check to see if the number of messages we want to sort through is greater than
     //   the number of messages we want to allow. If there are too many messages, it
     //   can fail and that's no good.
     $msg_to_pull = sizeof($new_msgs);
     // This check has had problems in the past
     if ($msg_to_pull > $max_imap_messages) {
         $msg_to_pull = $max_imap_messages;
     }
     $messages = array();
     for ($msgidx = 0; $msgidx < $msg_to_pull; $msgidx++) {
         $msgno = $new_msgs[$msgidx];
         $header = imap_headerinfo($this->imap_stream, $msgno);
         if (!isset($header->message_id) or !isset($header->udate)) {
             continue;
         }
         // Skip messages that aren't new/unseen
         // not sure we need this check now we use imap_search to pull only UNSEEN
         if ($header->Unseen != 'U' and $header->Recent != 'N') {
             continue;
         }
         $message_id = $header->message_id;
         $date = date($date_format, $header->udate);
         if (isset($header->from)) {
             $from = $header->from;
         } else {
             $from = FALSE;
         }
         $fromname = "";
         $fromaddress = "";
         $subject = "";
         $body = "";
         $attachments = "";
         if ($from != FALSE) {
             foreach ($from as $id => $object) {
                 if (isset($object->personal)) {
                     $fromname = $object->personal;
                 }
                 if (isset($object->mailbox) and isset($object->host)) {
                     $fromaddress = $object->mailbox . "@" . $object->host;
                 }
                 if ($fromname == "") {
                     // In case from object doesn't have Name
                     $fromname = $fromaddress;
                 }
             }
         }
         if (isset($header->subject)) {
             $subject = $this->_mime_decode($header->subject);
         }
         // Fetch Body
         $this->_getmsg($this->imap_stream, $msgno);
         if ($htmlmsg) {
             // Convert HTML to Text
             $html2text = new Html2Text($htmlmsg);
             $htmlmsg = $html2text->get_text();
         }
         $body = $plainmsg ? $plainmsg : $htmlmsg;
         // Fetch Attachments
         $attachments = $this->_extract_attachments($this->imap_stream, $msgno);
         // This isn't the perfect solution but windows-1256 encoding doesn't work with mb_detect_encoding()
         //   so if it doesn't return an encoding, lets assume it's arabic. (sucks)
         if (mb_detect_encoding($body, 'auto', TRUE) == '') {
             $body = iconv("windows-1256", "UTF-8", $body);
         }
         // Convert to valid UTF8
         $detected_encoding = mb_detect_encoding($body, "auto");
         if ($detected_encoding == 'ASCII') {
             $detected_encoding = 'iso-8859-1';
         }
         $body = mb_convert_encoding($body, $detected_encoding, 'UTF-8');
         $body = html::escape($body);
         $subject = html::strip_tags($subject);
         array_push($messages, array('message_id' => $message_id, 'date' => $date, 'from' => $fromname, 'email' => $fromaddress, 'subject' => $subject, 'body' => $body, 'attachments' => $attachments));
         // Mark Message As Read
         imap_setflag_full($this->imap_stream, $msgno, "\\Seen");
     }
     return $messages;
 }
    public function main()
    {
        ?>
		<div id="main">
			<div id="reports-new">
				<div class="ui error form segment square-corners no-shadow">
					<div class="three fields">
						<div class="field">
							<label>Год набора</label>
							<input id="year" name="year" placeholder="<?php 
        echo date::year();
        ?>
" type="text" value="<?php 
        echo $this->report->year;
        ?>
">
						</div>

						<div class="field">
							<label>Срок обучения (лет)</label>
							<input id="duration" name="duration" placeholder="4" type="text" value="<?php 
        echo $this->report->duration;
        ?>
" onchange="calendar.update();">
						</div>

						<div class="field">
							<label>ФИО ректора</label>
							<input id="rector" name="rector" placeholder="М.П. Батура" type="text" value="<?php 
        echo $this->report->rector;
        ?>
">
						</div>
					</div>

					<div class="field">
						<label>Регистрационный номер учебного плана</label>
						<input id="registration_number" name="registration_number" placeholder="2014.09.20/000" type="text" value="<?php 
        echo $this->report->registration_number;
        ?>
">
					</div>

					<div class="field">
						<div class="ui fluid selection dropdown">
							<div class="default text">Форма обучения</div>
							<i class="dropdown icon"></i>
							<input type="hidden" id="training_form_id" name="training_form_id" value="<?php 
        echo $this->report->training_form_id;
        ?>
">
							<div class="menu">
								<?php 
        $training_forms = training_forms::get();
        if ($training_forms) {
            foreach ($training_forms as $training_form) {
                ?>
											<div class="item" data-value="<?php 
                echo $training_form->id;
                ?>
"><?php 
                echo html::escape($training_form->name);
                ?>
</div>
											<?php 
            }
        }
        ?>
							</div>
						</div>
					</div>

					<div class="field">
						<div class="ui fluid selection dropdown">
							<div class="default text">Квалификация специалиста</div>
							<i class="dropdown icon"></i>
							<input type="hidden" id="qualification_id" name="qualification_id" value="<?php 
        echo $this->report->qualification_id;
        ?>
">
							<div class="menu">
								<?php 
        $qualifications = qualifications::get();
        if ($qualifications) {
            foreach ($qualifications as $qualification) {
                ?>
											<div class="item" data-value="<?php 
                echo $qualification->id;
                ?>
"><?php 
                echo html::escape($qualification->name);
                ?>
</div>
											<?php 
            }
        }
        ?>
							</div>
						</div>
					</div>

					<div class="field">
						<div class="ui fluid selection dropdown">
							<div class="default text">Специальность</div>
							<i class="dropdown icon"></i>
							<input type="hidden" id="specialty_id" name="specialty_id" value="<?php 
        echo $this->report->specialty_id;
        ?>
">
							<div class="menu">
								<?php 
        $specialties = specialties::get();
        if ($specialties) {
            foreach ($specialties as $specialty) {
                ?>
											<div class="item" data-value="<?php 
                echo $specialty->id;
                ?>
"><?php 
                echo html::escape($specialty->name);
                ?>
</div>
											<?php 
            }
        }
        ?>
							</div>
						</div>
					</div>

					<div class="field">
						<div class="ui fluid selection dropdown">
							<div class="default text">Специализация</div>
							<i class="dropdown icon"></i>
							<input type="hidden" id="specialization_id" name="specialization_id" value="<?php 
        echo $this->report->specialization_id;
        ?>
">
							<div class="menu">
								<?php 
        $specializations = specializations::get();
        if ($specializations) {
            foreach ($specializations as $specialization) {
                ?>
											<div class="item" data-value="<?php 
                echo $specialization->id;
                ?>
"><?php 
                echo html::escape($specialization->name);
                ?>
</div>
											<?php 
            }
        }
        ?>
							</div>
						</div>
					</div>

					<div class="field width50">
						<label>Учебная практика</label>
						<textarea id="study_practice" name="study_practice"><?php 
        echo $this->report->study_practice;
        ?>
</textarea>
					</div>

					<div class="field width50">
						<label>Производственная практика</label>
						<textarea id="manufact_practice" name="manufact_practice"><?php 
        echo $this->report->manufact_practice;
        ?>
</textarea>
					</div>

					<div class="field width50">
						<label>Дипломные проекты или дипломные работы</label>
						<input id="grad_work" name="grad_work" type="text" value="<?php 
        echo $this->report->grad_work;
        ?>
">
					</div>

					<div class="field width50">
						<label>Государственный экзамен</label>
						<input id="gos_exam" name="gos_exam" type="text" value="<?php 
        echo $this->report->gos_exam;
        ?>
">
					</div>

					<div id="education-list">
						<div class="ui form">

						</div>

						<ul id="education-ul">
							<?php 
        $educations = education::get_by_report(get('report_id'));
        ?>
							<?php 
        foreach ($educations as $education) {
            ?>
								<li class="disciplines" data-id="<?php 
            echo $education->id;
            ?>
">
									<div class="actions">
										<div class="ui button red tiny" onclick=" remove_education(this,<?php 
            echo $education->id;
            ?>
);buttons.update();">Удалить</div>
										<div class="ui button blue tiny" onclick="education.filler.popup(education.filler.get(this),education.filler.getdata(this),education.filler.getid(this),<?php 
            echo get('report_id');
            ?>
,<?php 
            echo $education->id;
            ?>
);">Заполнить</div>
									</div>
									<div class="base" onclick="$(this).parent('li').find('.tip').toggle('slow'); $(this).find('i.icon.triangle').toggleClass('down').toggleClass('right')">
										<i class="icon triangle down"></i>
										<span class="description"><?php 
            echo $education->name;
            ?>
</span>
									</div>
									<div class="tip">
										<ul>
											<?php 
            $educations_items = education_items::get_by_order($education->id);
            ?>
											<?php 
            foreach ($educations_items as $item) {
                $values = education_items_values::get_by_education_item_id($item->id);
                ?>
													<li data-order="<?php 
                echo $item->order_num;
                ?>
" data-type="undefined" data-name="<?php 
                echo $item->name;
                ?>
" data-id="<?php 
                echo $item->id;
                ?>
"
														data-values="<?php 
                for ($i = 1; $i < 40; $i++) {
                    foreach ($values as $value) {
                        if ($value->col_num == $i) {
                            echo $value->value;
                        }
                    }
                    echo ',';
                }
                ?>
"
														draggable="true"><?php 
                mb_strlen($item->name) > 96 ? $tmp = mb_substr($item->name, 0, 96, 'utf-8') . '...' : ($tmp = $item->name);
                echo $tmp;
                ?>
														<i class="icon remove circle" style="float: right" onclick="delete_item_discipline(this,<?php 
                echo $item->id;
                ?>
)" title="Удалить"></i>
														<i class="icon angle up" onclick="education.tip.move.up(this);"></i>
														<i class="icon angle down" onclick="education.tip.move.down(this);"></i>
														<div class="ui checkbox" style="float: right" data-content="Дисциплина по выбору">
															<input type="checkbox" class="popup" <?php 
                if ($item->is_optional == '1') {
                    echo "checked='checked'";
                }
                ?>
>
															<label></label>
														</div>
														</li>
												<?php 
            }
            ?>
										</ul>
										<div class="ui search selection dropdown" onclick="">
											<input type="hidden" name="selected">
											<div class="default text" onclick="$(this).html('')" onkeyup="education.hint.init(this)" contenteditable="true">Выберите наименование</div>
											<i class="dropdown icon"></i>
											<div class="menu">
												<?php 
            $disciplines = disciplines::get();
            foreach ($disciplines as $discipline) {
                ?>
													<div class="item" data-type="discipline" data-name="<?php 
                echo $discipline->name;
                ?>
"
														 data-id="<?php 
                echo $discipline->id;
                ?>
"><?php 
                echo $discipline->name;
                ?>
													</div>
												<?php 
            }
            ?>

												<?php 
            $directions = directions::get();
            foreach ($directions as $direction) {
                ?>
													<div class="item" data-type="direction" data-name="<?php 
                echo $direction->name;
                ?>
"
														 data-id="<?php 
                echo $direction->id;
                ?>
"><?php 
                echo $direction->name;
                ?>
													</div>
												<?php 
            }
            ?>

											</div>
										</div>

										<div class="item ui button green" onclick="add_education_item(<?php 
            echo $education->id;
            ?>
,this)">добавить</div>
									</div>
								</li>
							<?php 
        }
        ?>
						</ul>
					</div>

					<script>
						$('.ui.checkbox').popup({ on: 'hover' });


						function add_education_item(education_id,selector){

							if ($(selector).parent('div').find('.text').hasClass('default'))
							{
								alert('Выберите название предмета из выпадающего списка.');

								return;
							}


							var order = $(".tip li").length+1;
							var name = $(selector).closest('.tip').find('.item.active').attr('data-name');
							var report_id = <?php 
        echo get('report_id');
        ?>
;
							$.post('/?page=reports-edit&task=add_education_item&report_id='+report_id+'&name='+name+'&education_id='+education_id+'&order='+order+'&ajax=true')
								.done(function(id) { education.tip.add(selector,id)});
						}
						function delete_item_discipline(selector,id){
							var report_id = <?php 
        echo get('report_id');
        ?>
;
							$.post('/?page=reports-edit&task=delete_item_discipline&report_id='+report_id+'&id='+id+'&ajax=true')
								.done(function() { $(selector).parent().remove();});
						}
						function remove_education(selector,id){
							var report_id = <?php 
        echo get('report_id');
        ?>
;
							$.post('/?page=reports-edit&task=remove_education&report_id='+report_id+'&id='+id+'&ajax=true')
								.done(function() { $(selector).closest('li').fadeToggle('slow', function() { $(selector).closest('li').remove();  } )});
						}
						<?php 
        $disciplines = disciplines::get();
        $directions = directions::get();
        $database = null;
        if ($disciplines) {
            foreach ($disciplines as $discipline) {
                $database .= '["discipline", "' . html::escape($discipline->name) . '", ' . $discipline->id . '],';
            }
            $database = char::remove_last($database);
        }
        if ($directions) {
            if ($database) {
                $database .= ',';
            }
            foreach ($directions as $direction) {
                $database .= '["direction", "' . $direction->name . '", ' . $direction->id . '],';
            }
            $database = char::remove_last($database);
        }
        ?>

						var database = [<?php 
        echo $database;
        ?>
];

						$(function() {
							education.disciplines.set(database);
						});
					</script>


					<?php 
        //						$calendar = new ajax_calendar();
        //						$calendar->html();
        ?>

					<div class="ui green submit button small" onclick="update();">Сохранить</div>
					<a href="#" target="_blank" id="button-preview" class="ui blue submit button small" onclick="save(1); return false;">Предпросмотр</a>
					<a href="#" target="_blank" id="button-popup" class="ui blue submit button small" onclick="calendar.popup(); return false;">Календарь</a>
					<a href="#" target="_blank" id="button-education" class="ui blue submit button small" onclick="$('#education').modal('show'); return false;">Добавить цикл</a>

					<div id="education" class="ui modal large">
						<div class="ui form segment">
							<div class="field">
								<label>Наименование цикла</label>
								<input class="education-new" type="text" placeholder="Цикл социально-гуманитарных дисциплин">
							</div>

							<a href="#" class="ui blue submit button small" onclick="
							var name = $('.education-new').val();
							$('.education-new').val('');
							var report_id = <?php 
        echo get('report_id');
        ?>
;
							$.post('/?page=reports-edit&task=add_education&report_id='+report_id+'&name='+name+'&ajax=true')
								.done(function(data) { $('#education').modal('hide');
								education.add(name,data,report_id);
								/*rude.redirect('/?page=reports-edit&report_id='+report_id);*/ }); return false;
							">Добавить</a>
						</div>
					</div>

					<?php 
        static::filler();
        ?>

					<?php 
        static::calendar();
        ?>

				</div>
			</div>
		</div>
		<?php 
    }
예제 #16
0
if ($loggedin_user != FALSE) {
    ?>

				<a href="<?php 
    echo url::site() . $loggedin_role;
    ?>
">
					<span class="header_nav_label"><?php 
    echo html::escape($loggedin_user->username);
    ?>
</span>
					<img alt="<?php 
    echo html::escape($loggedin_user->username);
    ?>
" src="<?php 
    echo html::escape(members::gravatar($loggedin_user->email, 25));
    ?>
" width="25" />
				</a>

				<ul class="header_nav_dropdown" style="display:none;">
				<?php 
    if ($loggedin_role != "") {
        ?>
					<li><a href="<?php 
        echo url::site() . $loggedin_role;
        ?>
/profile"><?php 
        echo Kohana::lang('ui_main.manage_your_account');
        ?>
</a></li>
예제 #17
0
    public static function header($title = null, $description = null, $keywords = null)
    {
        ?>
		<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
			<?php 
        if ($title) {
            ?>
					<title><?php 
            echo html::escape($title);
            ?>
</title>
					<?php 
        }
        if ($description) {
            ?>
					<meta name="description" content="<?php 
            echo html::escape($description);
            ?>
">
					<?php 
        }
        if ($keywords) {
            $keywords = implode(', ', $keywords);
            ?>
					<meta name="keywords" content="<?php 
            echo html::escape($keywords);
            ?>
">
					<?php 
        }
        ?>

			<!-- template [CSS]-->
			<?php 
        echo html::css(RUDE_URL_SRC . '/css/style.css');
        ?>

			<!-- jQuery [JS]-->
			<?php 
        echo html::js(RUDE_URL_SRC . '/js/jquery/jquery-1.11.1.min.js');
        ?>

			<!-- jQuery plugins [JS]-->
			<?php 
        echo html::js(RUDE_URL_SRC . '/js/html5sortable/jquery.sortable.js');
        ?>
			<?php 
        echo html::js(RUDE_URL_SRC . '/js/jqueryrotate/jQueryRotateCompressed.js');
        ?>

			<!-- semanic-ui [CSS]-->
			<?php 
        echo html::css(RUDE_URL_SRC . '/js/semantic/packaged/css/semantic.min.css');
        ?>
			<!-- semanic-ui [JS]-->
			<?php 
        echo html::js(RUDE_URL_SRC . '/js/semantic/packaged/javascript/semantic.min.js');
        ?>

			<!-- rude [JS] -->
			<?php 
        echo html::js(RUDE_URL_SRC . '/js/rude/rude.js');
        ?>
			<?php 
        echo html::js(RUDE_URL_SRC . '/js/rude/rude-education.js');
        ?>
			<?php 
        echo html::js(RUDE_URL_SRC . '/js/rude/rude-dimmer.js');
        ?>
		</head>
		<?php 
    }
예제 #18
0
 /**
  * Generates the HTML for embedding a video
  *
  * @param string $raw URL of the video to be embedded
  * @param boolean $auto Autoplays the video as soon as its loaded
  * @param boolean $echo Should we echo the embed code or just return it
  * @return
  */
 public function embed($raw, $auto = FALSE, $echo = TRUE)
 {
     $this->set_url($raw);
     $output = FALSE;
     // Get video code from url.
     if (isset($this->service['baseurl'])) {
         $code = str_replace($this->service['baseurl'], "", $this->url);
     }
     switch ($this->service_name) {
         case "youtube":
             // Check for autoplay
             $you_auto = $auto ? "&autoplay=1" : "";
             $output = '<iframe id="ytplayer" type="text/html" width="320" height="265" ' . 'src="//www.youtube.com/embed/' . html::escape($code) . '?origin=' . urlencode(url::base()) . html::escape($you_auto) . '" ' . 'frameborder="0"></iframe>';
             break;
         case "google":
             // Check for autoplay
             $google_auto = $auto ? "&autoPlay=true" : "";
             $output = "<embed style='width:320px; height:265px;' id='VideoPlayback' type='application/x-shockwave-flash'" . "\tsrc='//video.google.com/googleplayer.swf?docId=-" . html::escape($code . $google_auto) . "&hl=en' flashvars=''>" . "</embed>";
             break;
         case "metacafe":
             // Sanitize input
             $code = strrev(trim(strrev($code), "/"));
             $output = "<embed src='http://www.metacafe.com/fplayer/" . html::escape($code) . ".swf'" . "\twidth='320' height='265' wmode='transparent' pluginspage='http://get.adobe.com/flashplayer/'" . "\ttype='application/x-shockwave-flash'> " . "</embed>";
             break;
         case "dotsub":
             $output = "<iframe src='http://dotsub.com/media/" . html::escape($code) . "' frameborder='0' width='320' height='500'></iframe>";
             break;
         case "vimeo":
             $vimeo_auto = $auto ? "?autoplay=1" : "";
             $output = '<iframe src="//player.vimeo.com/video/' . html::escape($code . $vimeo_auto) . '" width="320" height="265" frameborder="0">' . '</iframe>';
             break;
     }
     $data = array($this->service_name, $output);
     Event::run('ushahidi_filter.video_embed_embed', $data);
     list($this->service_name, $output) = $data;
     if (!$output) {
         $output = '<a href="' . $this->url . '" target="_blank">' . Kohana::lang('ui_main.view_video') . '</a>';
     }
     if ($echo) {
         echo $output;
     }
     return $output;
 }
예제 #19
0
    }
    ?>
						</div>
						<?php 
    // Action::report_extra_media - Add items to the report list in the media section
    Event::run('ushahidi_action.report_extra_media', $incident_id);
    ?>
					</div>

					<div class="r_details">
						<h3><a class="r_title" href="<?php 
    echo $incident_url;
    ?>
">
								<?php 
    echo html::escape($incident_title);
    ?>
							</a>
							<a href="<?php 
    echo "{$incident_url}#discussion";
    ?>
" class="r_comments">
								<?php 
    echo $comment_count;
    ?>
</a> 
								<?php 
    echo $incident_verified;
    ?>
							</h3>
						<p class="r_date r-3 bottom-cap"><?php 
예제 #20
0
</h5>

	<?php 
    foreach ($incident_comments as $comment) {
        ?>
		<div class="report-comment-box">

			<div>
				<strong><?php 
        echo html::strip_tags($comment->comment_author);
        ?>
</strong>&nbsp;(<?php 
        echo date('M j Y', strtotime($comment->comment_date));
        ?>
)
			</div>

			<div><?php 
        echo html::escape($comment->comment_description);
        ?>
</div>

		</div>
	<?php 
    }
    ?>

</div>

<?php 
}
예제 #21
0
Event::run('ushahidi_action.report_display_media', $incident_id);
?>

		<!-- start report media -->
		<div class="<?php 
if (count($incident_photos) > 0 || count($incident_videos) > 0) {
    echo "report-media";
}
?>
">
			<?php 
// if there are images, show them
if (count($incident_photos) > 0) {
    echo '<div id="report-images">';
    foreach ($incident_photos as $photo) {
        echo '<a class="photothumb" rel="lightbox-group1" href="' . $photo['large'] . '"><img alt="' . html::escape($incident_title) . '" src="' . $photo['thumb'] . '"/></a> ';
    }
    echo '</div>';
}
// if there are videos, show those too
if (count($incident_videos) > 0) {
    echo "<div id=\"report-video\"><ul>\n";
    // embed the video codes
    foreach ($incident_videos as $incident_video) {
        echo "<li>\n\t";
        echo $videos_embed->embed($incident_video, FALSE, FALSE);
        echo "\n</li>\n";
    }
    echo "</ul></div>";
}
?>
예제 #22
0
파일: model.php 프로젝트: xpd1437/swap
 public function html_escape()
 {
     $that = clone $this;
     $that->_current_props = html::escape($that->_current_props);
     return $that;
 }
예제 #23
0
 /**
  * Lists the reports.
  *
  * @param int $page
  */
 public function index($page = 1)
 {
     // If user doesn't have access, redirect to dashboard
     if (!$this->auth->has_permission("reports_view")) {
         url::redirect(url::site() . 'admin/dashboard');
     }
     $this->template->content = new View('admin/reports/main');
     $this->template->content->title = Kohana::lang('ui_admin.reports');
     // Database table prefix
     $table_prefix = Kohana::config('database.default.table_prefix');
     // Hook into the event for the reports::fetch_incidents() method
     Event::add('ushahidi_filter.fetch_incidents_set_params', array($this, '_add_incident_filters'));
     $status = "0";
     if (!empty($_GET['status'])) {
         $status = $_GET['status'];
         if (strtolower($status) == 'a') {
             array_push($this->params, 'i.incident_active = 0');
         } elseif (strtolower($status) == 'v') {
             array_push($this->params, 'i.incident_verified = 0');
         } elseif (strtolower($status) == 'o') {
             array_push($this->params, '(ic.category_id IS NULL)');
         } elseif (strtolower($status) != 'search') {
             $status = "0";
         }
     }
     // Get Search Keywords (If Any)
     if (isset($_GET['k'])) {
         //	Brute force input sanitization
         // Phase 1 - Strip the search string of all non-word characters
         $keyword_raw = isset($_GET['k']) ? preg_replace('#/\\w+/#', '', $_GET['k']) : "";
         // Strip any HTML tags that may have been missed in Phase 1
         $keyword_raw = strip_tags($keyword_raw);
         // Phase 3 - Invoke Kohana's XSS cleaning mechanism just incase an outlier wasn't caught
         // in the first 2 steps
         $keyword_raw = $this->input->xss_clean($keyword_raw);
         $filter = " (" . $this->_get_searchstring($keyword_raw) . ")";
         array_push($this->params, $filter);
     } else {
         $keyword_raw = "";
     }
     $this->template->content->search_form = $this->_search_form();
     $this->template->content->search_form->keywords = $keyword_raw;
     // Handler sort/order fields
     $order_field = 'date';
     $sort = 'DESC';
     if (isset($_GET['order'])) {
         $order_field = html::escape($_GET['order']);
     }
     if (isset($_GET['sort'])) {
         $sort = strtoupper($_GET['sort']) == 'ASC' ? 'ASC' : 'DESC';
     }
     // Check, has the form been submitted?
     $form_error = FALSE;
     $errors = array();
     $form_saved = FALSE;
     $form_action = "";
     if ($_POST) {
         $post = Validation::factory($_POST);
         //	Add some filters
         $post->pre_filter('trim', TRUE);
         // Add some rules, the input field, followed by a list of checks,
         // carried out in order
         $post->add_rules('action', 'required', 'alpha', 'length[1,1]');
         $post->add_rules('incident_id.*', 'required', 'numeric');
         if (in_array($post->action, array('a', 'u')) and !Auth::instance()->has_permission('reports_approve')) {
             $post->add_error('action', 'permission');
         }
         if ($post->action == 'v' and !Auth::instance()->has_permission('reports_verify')) {
             $post->add_error('action', 'permission');
         }
         if ($post->action == 'd' and !Auth::instance()->has_permission('reports_edit')) {
             $post->add_error('action', 'permission');
         }
         if ($post->action == 'a') {
             // sanitize the incident_ids
             $post->incident_id = array_map('intval', $post->incident_id);
             // Query to check if this report is uncategorized i.e categoryless
             $query = "SELECT i.* FROM " . $table_prefix . "incident i " . "LEFT JOIN " . $table_prefix . "incident_category ic ON i.id=ic.incident_id " . "LEFT JOIN " . $table_prefix . "category c ON c.id = ic.category_id " . "WHERE c.id IS NULL " . "AND i.id IN :incidentids";
             $result = Database::instance()->query($query, array(':incidentids' => $post->incident_id));
             // We enly approve the report IF it's categorized
             // throw an error if any incidents aren't categorized
             foreach ($result as $incident) {
                 $post->add_error('incident_id', 'categories_required', $incident->incident_title);
             }
         }
         if ($post->validate()) {
             // Approve Action
             if ($post->action == 'a') {
                 foreach ($post->incident_id as $item) {
                     $update = new Incident_Model($item);
                     if ($update->loaded == TRUE) {
                         $update->incident_active = '1';
                         // Tag this as a report that needs to be sent out as an alert
                         if ($update->incident_alert_status != '2') {
                             // 2 = report that has had an alert sent
                             $update->incident_alert_status = '1';
                         }
                         $update->save();
                         // Record 'Verified By' Action
                         reports::verify_approve($update);
                         // Action::report_approve - Approve a Report
                         Event::run('ushahidi_action.report_approve', $update);
                     }
                     $form_action = utf8::strtoupper(Kohana::lang('ui_admin.approved'));
                 }
             } elseif ($post->action == 'u') {
                 foreach ($post->incident_id as $item) {
                     $update = new Incident_Model($item);
                     if ($update->loaded == TRUE) {
                         $update->incident_active = '0';
                         // If Alert hasn't been sent yet, disable it
                         if ($update->incident_alert_status == '1') {
                             $update->incident_alert_status = '0';
                         }
                         $update->save();
                         // Record 'Verified By' Action
                         reports::verify_approve($update);
                         // Action::report_unapprove - Unapprove a Report
                         Event::run('ushahidi_action.report_unapprove', $update);
                     }
                 }
                 $form_action = utf8::strtoupper(Kohana::lang('ui_admin.unapproved'));
             } elseif ($post->action == 'v') {
                 foreach ($post->incident_id as $item) {
                     $update = new Incident_Model($item);
                     $verify = new Verify_Model();
                     if ($update->loaded == TRUE) {
                         if ($update->incident_verified == '1') {
                             $update->incident_verified = '0';
                             $verify->verified_status = '0';
                         } else {
                             $update->incident_verified = '1';
                             $verify->verified_status = '2';
                         }
                         $update->save();
                         // Record 'Verified By' Action
                         reports::verify_approve($update);
                     }
                 }
                 // Set the form action
                 $form_action = utf8::strtoupper(Kohana::lang('ui_admin.verified_unverified'));
             } elseif ($post->action == 'd') {
                 foreach ($post->incident_id as $item) {
                     $update = new Incident_Model($item);
                     if ($update->loaded) {
                         $update->delete();
                     }
                 }
                 $form_action = utf8::strtoupper(Kohana::lang('ui_admin.deleted'));
             }
             $form_saved = TRUE;
         } else {
             // Repopulate the form fields
             //$form = arr::overwrite($form, $post->as_array());
             // Populate the error fields, if any
             $errors = $post->errors('reports');
             $form_error = TRUE;
         }
     }
     // Fetch all incidents
     $incidents = reports::fetch_incidents(TRUE, Kohana::config('settings.items_per_page_admin'));
     Event::run('ushahidi_filter.filter_incidents', $incidents);
     $this->template->content->countries = Country_Model::get_countries_list();
     $this->template->content->incidents = $incidents;
     $this->template->content->pagination = reports::$pagination;
     $this->template->content->form_error = $form_error;
     $this->template->content->errors = $errors;
     $this->template->content->form_saved = $form_saved;
     $this->template->content->form_action = $form_action;
     // Total Reports
     $this->template->content->total_items = reports::$pagination->total_items;
     // Status Tab
     $this->template->content->status = $status;
     $this->template->content->order_field = $order_field;
     $this->template->content->sort = $sort;
     $this->themes->map_enabled = TRUE;
     $this->themes->json2_enabled = TRUE;
     $this->themes->treeview_enabled = TRUE;
     // Javascript Header
     $this->themes->js = new View('admin/reports/reports_js');
 }
    public function main()
    {
        ?>
		<div id="main">
		<div id="reports-new">
		<div class="ui error form segment square-corners no-shadow">
		<div class="three fields">
			<div class="field">
				<label>Год набора</label>
				<input id="year" name="year" placeholder="Год набора" type="text">
			</div>

			<div class="field">
				<label>Срок обучения (лет)</label>
				<input id="duration" name="duration" placeholder="4" type="text" onchange="calendar.update();">
			</div>

			<div class="field">
				<label>ФИО ректора</label>
				<?php 
        $settings = settings::get_rector_value(template_session::get_user_id());
        $rector = $settings->value;
        ?>
				<input id="rector" name="rector" value="<?php 
        if (!empty($rector)) {
            echo $rector;
        }
        ?>
" placeholder="М.П. Батура" type="text" >
			</div>
		</div>

		<div class="field">
			<label>Регистрационный номер учебного плана</label>
			<input id="registration_number" name="registration_number" placeholder="2014.09.20/000" type="text" >
		</div>

		<div class="field">
			<div class="ui fluid selection dropdown">
				<div class="default text">Форма обучения</div>
				<i class="dropdown icon"></i>
				<input type="hidden" id="training_form_id" name="training_form_id">
				<div class="menu">
					<?php 
        $training_forms = training_forms::get();
        if ($training_forms) {
            foreach ($training_forms as $training_form) {
                ?>
							<div class="item" data-value="<?php 
                echo $training_form->id;
                ?>
"><?php 
                echo html::escape($training_form->name);
                ?>
</div>
						<?php 
            }
        }
        ?>
				</div>
			</div>
		</div>

		<div class="field">
			<div class="ui fluid selection dropdown">
				<div class="default text">Квалификация специалиста</div>
				<i class="dropdown icon"></i>
				<input type="hidden" id="qualification_id" name="qualification_id" >
				<div class="menu">
					<?php 
        $qualifications = qualifications::get();
        if ($qualifications) {
            foreach ($qualifications as $qualification) {
                ?>
							<div class="item" data-value="<?php 
                echo $qualification->id;
                ?>
"><?php 
                echo html::escape($qualification->name);
                ?>
</div>
						<?php 
            }
        }
        ?>
				</div>
			</div>
		</div>

		<div class="field">
			<div class="ui fluid selection dropdown">
				<div class="default text">Специальность</div>
				<i class="dropdown icon"></i>
				<input type="hidden" id="specialty_id" name="specialty_id">
				<div class="menu">
					<?php 
        $specialties = specialties::get();
        if ($specialties) {
            foreach ($specialties as $specialty) {
                ?>
							<div class="item" data-value="<?php 
                echo $specialty->id;
                ?>
"><?php 
                echo html::escape($specialty->name);
                ?>
</div>
						<?php 
            }
        }
        ?>
				</div>
			</div>
		</div>

		<div class="field">
			<div class="ui fluid selection dropdown">
				<div class="default text">Специализация</div>
				<i class="dropdown icon"></i>
				<input type="hidden" id="specialization_id" name="specialization_id" >
				<div class="menu">
					<?php 
        $specializations = specializations::get();
        if ($specializations) {
            foreach ($specializations as $specialization) {
                ?>
							<div class="item" data-value="<?php 
                echo $specialization->id;
                ?>
"><?php 
                echo html::escape($specialization->name);
                ?>
</div>
						<?php 
            }
        }
        ?>
				</div>
			</div>
		</div>

		<?php 
        //						$calendar = new ajax_calendar();
        //						$calendar->html();
        ?>

		<div class="ui green submit button small" onclick="save(0); return false;">Сохранить</div>
		<a href="#" target="_blank" id="button-preview" class="ui blue submit button small" onclick="save(1); return false;">Предпросмотр</a>
		<a href="#" target="_blank" id="button-popup" class="ui blue submit button small" onclick="calendar.popup(); return false;">Календарь</a>

		<div class="ui dimmer page hidden">
		<div id="calendar" class="ui modal large transition hidden">
		<i class="close icon"></i>

		<div class="header">
			Календарь
		</div>

		<div class="content">
		<table class="ui basic table">
		<tr>
			<th rowspan="3">к<br/>у<br/>р<br/>с<br/>ы</th>
			<th colspan="4">Сентябрь</th>
			<th></th>
			<th colspan="3">Октябрь</th>
			<th></th>
			<th colspan="4">Ноябрь</th>
			<th colspan="4">Декабрь</th>
			<th></th>
			<th colspan="3">Январь</th>
			<th></th>
			<th colspan="3">Февраль</th>
			<th></th>
			<th colspan="4">Март</th>
			<th></th>
			<th colspan="3">Апрель</th>
			<th></th>
			<th colspan="4">Май</th>
			<th colspan="4">Июнь</th>
			<th></th>
			<th colspan="3">Июль</th>
			<th></th>
			<th colspan="4">Август</th>
		</tr>
		<tr>
			<td>1</td>
			<td>8</td>
			<td>15</td>
			<td>22</td>
			<td>
				<div class="underline">29</div>
				09
			</td>
			<td>6</td>
			<td>13</td>
			<td>20</td>
			<td>
				<div class="underline">27</div>
				10
			</td>
			<td>3</td>
			<td>10</td>
			<td>17</td>
			<td>24</td>
			<td>1</td>
			<td>8</td>
			<td>15</td>
			<td>22</td>
			<td>
				<div class="underline">29</div>
				12
			</td>
			<td>5</td>
			<td>12</td>
			<td>19</td>
			<td>
				<div class="underline">26</div>
				01
			</td>
			<td>2</td>
			<td>9</td>
			<td>16</td>
			<td>
				<div class="underline">23</div>
				02
			</td>
			<td>2</td>
			<td>9</td>
			<td>16</td>
			<td>23</td>
			<td>
				<div class="underline">30</div>
				03
			</td>
			<td>6</td>
			<td>13</td>
			<td>20</td>
			<td>
				<div class="underline">27</div>
				04
			</td>
			<td>4</td>
			<td>11</td>
			<td>18</td>
			<td>25</td>
			<td>1</td>
			<td>8</td>
			<td>15</td>
			<td>22</td>
			<td>
				<div class="underline">29</div>
				06
			</td>
			<td>6</td>
			<td>13</td>
			<td>20</td>
			<td>
				<div class="underline">27</div>
				07
			</td>
			<td>3</td>
			<td>10</td>
			<td>17</td>
			<td>24</td>
		</tr>
		<tr>
			<td>7</td>
			<td>14</td>
			<td>21</td>
			<td>28</td>
			<td>
				<div class="underline">05</div>
				10
			</td>
			<td>12</td>
			<td>19</td>
			<td>26</td>
			<td>
				<div class="underline">02</div>
				11
			</td>
			<td>7</td>
			<td>16</td>
			<td>23</td>
			<td>30</td>
			<td>7</td>
			<td>14</td>
			<td>21</td>
			<td>28</td>
			<td>
				<div class="underline">04</div>
				01
			</td>
			<td>11</td>
			<td>18</td>
			<td>25</td>
			<td>
				<div class="underline">01</div>
				02
			</td>
			<td>8</td>
			<td>15</td>
			<td>22</td>
			<td>
				<div class="underline">01</div>
				03
			</td>
			<td>8</td>
			<td>15</td>
			<td>22</td>
			<td>29</td>
			<td>
				<div class="underline">05</div>
				04
			</td>
			<td>12</td>
			<td>19</td>
			<td>26</td>
			<td>
				<div class="underline">03</div>
				05
			</td>
			<td>10</td>
			<td>17</td>
			<td>24</td>
			<td>31</td>
			<td>7</td>
			<td>14</td>
			<td>21</td>
			<td>28</td>
			<td>
				<div class="underline">05</div>
				07
			</td>
			<td>12</td>
			<td>19</td>
			<td>26</td>
			<td>
				<div class="underline">02</div>
				08
			</td>
			<td>9</td>
			<td>16</td>
			<td>23</td>
			<td>31</td>
		</tr>

		<?php 
        for ($i = 1; $i <= 0; $i++) {
            ?>
<tr id="generated-<?php 
            echo $i;
            ?>
" class="generated"><td><?php 
            echo int::to_roman($i);
            ?>
</td><?php 
            for ($j = 1; $j < 53; $j++) {
                $val = '';
                ?>
					<td>
						<div class="ui form">
							<div class="inline field">
								<input class="<?php 
                echo $j;
                ?>
" type="text" maxlength="2" value="<?php 
                echo $val;
                ?>
">
							</div>
						</div>
					</td>
				<?php 
            }
            ?>
</tr><?php 
        }
        ?>
		</table>

		<br />

		<div class="ui icon buttons constructor">
			<div class="ui button" onclick="calendar_char = ''"><i class="align icon eraser"></i></div>

			<?php 
        $legend = calendar_legend::get();
        if ($legend) {
            foreach ($legend as $item) {
                ?>
						<div class="ui button constructor" title="<?php 
                echo $item->description;
                ?>
" onclick="calendar_char = '<?php 
                echo $item->legend_letter;
                ?>
'"><?php 
                echo $item->legend_letter;
                ?>
</div>
						<?php 
            }
        }
        ?>
		</div>

		<script>
			rude.semantic.init.buttons();


			var calendar_char = '';


			$(function () {
				mouse_selection();
			});

			function mouse_selection()
			{
				var isMouseDown = false;

				$('#calendar .content table.ui.basic td')
					.mousedown(function () {
						isMouseDown = true;

						$(this).addClass('highlighted');
						$(this).find('input').val(calendar_char);

						return false; // prevent text selection
					})
					.mouseover(function () {
						if (isMouseDown) {
							$(this).addClass('highlighted');
							$(this).find('input').val(calendar_char);
						}
					});

				$(document)
					.mouseup(function () {
						isMouseDown = false;
					});
			}
		</script>


		<a href="#" target="_blank" id="button-save" class="ui blue submit button small" onclick="calendar.save(0); $('#calendar .icon.close').click(); return false;">Сохранить</a>
		</div>
		</div>
		</div>

		<div style="display: none">
			<table>
				<tr id="calendar-hidden">
					<?php 
        for ($i = 1; $i < 53; $i++) {
            ?>
							<td>
								<div class="ui form">
									<div class="inline field">
										<input class="<?php 
            echo $i;
            ?>
" type="text" maxlength="2">
									</div>
								</div>
							</td>
							<?php 
        }
        ?>
				</tr>
			</table>
		</div>


		<script>
			function save(is_tmp)
			{
				var report = new Report();
				$.ajax(
					{
						url: '/?page=reports-new&task=add&ajax=true&is_tmp=' + is_tmp,

						data:
						{
							is_tmp:              is_tmp,

							year:                report.year,
							duration:            report.duration,
							rector:              report.rector,
							registration_number: report.registration_number,
							training_form_id:    report.training_form_id,
							qualification_id:    report.qualification_id,
							specialty_id:        report.specialty_id,
							specialization_id:   report.specialization_id
						},

						success: function (report_id)
						{
							console.log(report_id);

							if (report_id)
							{
								if (is_tmp)
								{
									calendar.save(1, report_id, true);
								}
								else
								{
									calendar.save(0, report_id, false);
									rude.redirect('/?page=reports-edit&report_id=' + report_id);
								}
							}
						}
					});
			}



			function Report()
			{
				this.year                = $('#year').val();
				this.duration            = $('#duration').val();
				this.rector              = $('#rector').val();
				this.registration_number = $('#registration_number').val();
				this.training_form_id    = $('#training_form_id').val();
				this.qualification_id    = $('#qualification_id').val();
				this.specialty_id        = $('#specialty_id').val();
				this.specialization_id   = $('#specialization_id').val();
			}

			var calendar =
			{

				reset: function()
				{
					$('#calendar .generated').remove();
				},

				update: function()
				{
					var duration = $('#duration').val();

					if (calendar.duration === null || calendar.duration != duration)
					{
						calendar.reset();

						var row = $('#calendar-hidden').html();

						for (var i = 1; i <= duration; i++)
						{
							$('#calendar table').append('<tr id="generated-' + i + '" class="generated"><td>' + rude.romanize(i) + '</td>' + row + '</tr>');
						}
					}

					calendar.duration = duration;

					mouse_selection();
				},

				popup: function()
				{
					if (calendar.duration === null)
					{
						calendar.update();
					}

					$('#calendar').modal('show').modal('cache sizes');

					setTimeout(function() {
						$('#calendar').modal('refresh');
					}, 750);
				},

				get: function()
				{
					var result = [];

					for (var i = 1; i <= $('#duration').val(); i++)
					{
						var selector = '#generated-' + i;

						if ($(selector).length)
						{
							var cols = $(selector + ' td').length;

							for (var j = 1; j < cols; j++)
							{
								if ($(selector + ' .' + j).val() !== '')
								{
									result.push([i, j, $(selector + ' .' + j).val()]);
								}
							}
						}
					}

					return result;
				},

				save: function(is_tmp, report_id, prewiew)
				{
					var data = calendar.get();





					$.ajax(
						{
							url: '/?page=calendar&task=save&ajax=true',

							type: 'POST',

							data:
							{
								is_tmp: is_tmp,

								data: data,
								report_id: report_id
							},

							success: function (data)
							{
								console.log(data);


								if (prewiew)
								{
									rude.open('/?page=reports-preview&is_tmp=1&report_id=' + report_id, true);
								}
							}
						});
				}
			}
		</script>
		</div>
		</div>
		</div>
	<?php 
    }
 public static function ajax($page, $task, $id)
 {
     return '/?page=' . html::escape($page) . '&task=' . html::escape($task) . '&id=' . html::escape($id) . '&ajax=true';
 }
예제 #26
0
			<div class="background layoutleft">

				<!-- mainmenu -->
				<div id="mainmenu" class="clearingfix">
					<ul>
						<!-- JP: Show or hide reports_submit tab, depending on settings. -->
						<?php 
nav::main_tabs($this_page, Kohana::config('settings.show_submit_report_tab') ? array() : array('reports_submit'));
?>
					</ul>

					<?php 
if ($allow_feed == 1) {
    ?>
					<div class="feedicon"><a href="<?php 
    echo url::site();
    ?>
feed/"><img alt="<?php 
    echo html::escape(Kohana::lang('ui_main.rss'));
    ?>
" src="<?php 
    echo url::file_loc('img');
    ?>
media/img/icon-feed.png" style="vertical-align: middle;" border="0" /></a></div>
					<?php 
}
?>

				</div>
				<!-- / mainmenu -->
예제 #27
0
								<?php 
if ($total_items == 0) {
    ?>
									<tr>
										<td colspan="4" class="col">
											<h3><?php 
    echo Kohana::lang('ui_main.no_results');
    ?>
</h3>
										</td>
									</tr>
								<?php 
}
foreach ($incidents as $incident) {
    $incident_id = $incident->id;
    $incident_title = html::escape($incident->incident_title);
    $incident_description = text::limit_chars(html::strip_tags($incident->incident_description), 150, "...", true);
    $incident_date = $incident->incident_date;
    $incident_date = date('Y-m-d', strtotime($incident->incident_date));
    $incident_mode = $incident->incident_mode;
    // Mode of submission... WEB/SMS/EMAIL?
    //XXX incident_Mode will be discontinued in favour of $service_id
    if ($incident_mode == 1) {
        $submit_mode = "WEB";
        // Who submitted the report?
        if ($incident->incident_person->id) {
            // Report was submitted by a visitor
            $submit_by = $incident->incident_person->person_first . " " . $incident->incident_person->person_last;
        } else {
            if ($incident->user_id) {
                $submit_by = $incident->user->name;
예제 #28
0
 /**
  * Import Reports via XML
  * @param DOMNodeList Object $report
  * @return bool
  */
 public function import_reports($reports)
 {
     /* Import individual reports */
     foreach ($reports->getElementsByTagName('report') as $report) {
         $this->totalreports++;
         // Get Report id
         $report_id = $report->getAttribute('id');
         // Check if this incident already exists in the db
         if (isset($report_id) and isset($this->incident_ids[$report_id])) {
             $this->notices[] = Kohana::lang('import.incident_exists') . $report_id;
         } else {
             /* Step 1: Location information */
             $locations = $report->getElementsByTagName('location');
             // If location information has been provided
             if ($locations->length > 0) {
                 $report_location = $locations->item(0);
                 // Location Name
                 $location_name = xml::get_node_text($report_location, 'name');
                 // Longitude
                 $longitude = xml::get_node_text($report_location, 'longitude');
                 // Latitude
                 $latitude = xml::get_node_text($report_location, 'latitude');
                 if ($location_name) {
                     // For geocoding purposes
                     $location_geocoded = map::geocode($location_name);
                     // Save the location
                     $new_location = new Location_Model();
                     $new_location->location_name = $location_name ? $location_name : NULL;
                     $new_location->location_date = $this->time;
                     // If longitude/latitude values are present
                     if ($latitude and $longitude) {
                         $new_location->latitude = $latitude ? $latitude : 0;
                         $new_location->longitude = $longitude ? $longitude : 0;
                     } else {
                         // Get geocoded lat/lon values
                         $new_location->latitude = $location_geocoded ? $location_geocoded['latitude'] : $latitude;
                         $new_location->longitude = $location_geocoded ? $location_geocoded['longitude'] : $longitude;
                     }
                     $new_location->country_id = $location_geocoded ? $location_geocoded['country_id'] : 0;
                     $new_location->save();
                     // Add this location to array of imported locations
                     $this->locations_added[] = $new_location->id;
                 }
             }
             /* Step 2: Save Report */
             // Report Title
             $report_title = xml::get_node_text($report, 'title');
             // Report Date
             $report_date = xml::get_node_text($report, 'date');
             // Missing report title or report date?
             if (!$report_title or !$report_date) {
                 $this->errors[] = Kohana::lang('import.xml.incident_title_date') . $this->totalreports;
             }
             // If report date is not in the required format
             if (!strtotime($report_date)) {
                 $this->errors[] = Kohana::lang('import.incident_date') . $this->totalreports . ': ' . html::escape($report_date);
             } else {
                 // Approval status?
                 $approved = $report->getAttribute('approved');
                 $report_approved = (isset($approved) and in_array($approved, $this->allowable)) ? $approved : 0;
                 // Verified Status?
                 $verified = $report->getAttribute('verified');
                 $report_verified = (isset($verified) and in_array($verified, $this->allowable)) ? $verified : 0;
                 // Report mode?
                 $allowed_modes = array(1, 2, 3, 4);
                 $mode = $report->getAttribute('mode');
                 $report_mode = (isset($mode) and in_array($mode, $allowed_modes)) ? $mode : 1;
                 // Report Form
                 $report_form = xml::get_node_text($report, 'form_name', FALSE);
                 if ($report_form) {
                     if (!isset($this->existing_forms[utf8::strtoupper($report_form)])) {
                         $this->notices[] = Kohana::lang('import.xml.no_form_exists') . $this->totalreports . ': "' . $report_form . '"';
                     }
                     $form_id = isset($this->existing_forms[utf8::strtoupper($report_form)]) ? $this->existing_forms[utf8::strtoupper($report_form)] : 1;
                 }
                 // Report Date added
                 $dateadd = xml::get_node_text($report, 'dateadd');
                 // Report Description
                 $report_description = xml::get_node_text($report, 'description');
                 $new_report = new Incident_Model();
                 $new_report->location_id = isset($new_location) ? $new_location->id : 0;
                 $new_report->user_id = 0;
                 $new_report->incident_title = $report_title;
                 $new_report->incident_description = $report_description ? $report_description : '';
                 $new_report->incident_date = date("Y-m-d H:i:s", strtotime($report_date));
                 $new_report->incident_dateadd = ($dateadd and strtotime($dateadd)) ? $dateadd : $this->time;
                 $new_report->incident_active = $report_approved;
                 $new_report->incident_verified = $report_verified;
                 $new_report->incident_mode = $report_mode;
                 $new_report->form_id = isset($form_id) ? $form_id : 1;
                 $new_report->save();
                 // Increment imported rows counter
                 $this->importedreports++;
                 // Add this report to array of reports added during import
                 $this->incidents_added[] = $new_report->id;
                 /* Step 3: Save Report Categories*/
                 // Report Categories exist?
                 $reportcategories = $report->getElementsByTagName('report_categories');
                 if ($reportcategories->length > 0) {
                     $report_categories = $reportcategories->item(0);
                     foreach ($report_categories->getElementsByTagName('category') as $r_category) {
                         $category = trim($r_category->nodeValue);
                         $report_category = (isset($category) and $category != '') ? $category : '';
                         if ($report_category != '' and isset($this->existing_categories[utf8::strtoupper($report_category)])) {
                             // Save the incident category
                             $new_incident_category = new Incident_Category_Model();
                             $new_incident_category->incident_id = $new_report->id;
                             $new_incident_category->category_id = $this->existing_categories[utf8::strtoupper($report_category)];
                             $new_incident_category->save();
                             // Add this to array of incident categories added
                             $this->incident_categories_added[] = $new_incident_category->id;
                         }
                         if ($report_category != '' and !isset($this->existing_categories[utf8::strtoupper($report_category)])) {
                             $this->notices[] = Kohana::lang('import.xml.no_category_exists') . $this->totalreports . ': "' . $report_category . '"';
                         }
                     }
                 }
                 /* Step 4: Save Custom form field responses for this report */
                 // Report Custom Fields
                 $this_form = $new_report->form_id;
                 $reportfields = $report->getElementsByTagName('custom_fields');
                 if ($reportfields->length > 0) {
                     $report_fields = $reportfields->item(0);
                     $custom_fields = $report_fields->getElementsByTagName('field');
                     if ($custom_fields->length > 0) {
                         foreach ($custom_fields as $field) {
                             // Field Name
                             $field_name = $field->hasAttribute('name') ? xml::get_node_text($field, 'name', FALSE) : FALSE;
                             if ($field_name) {
                                 // If this field exists in the form listed for this report
                                 if (isset($this->existing_fields[utf8::strtoupper($field_name)][$this_form])) {
                                     // Get field type and default values
                                     $match_field_id = $this->existing_fields[utf8::strtoupper($field_name)][$this_form];
                                     // Grab form field object
                                     $match_fields = ORM::Factory('form_field', $match_field_id);
                                     $match_field_type = $match_fields->field_type;
                                     $match_field_defaults = $match_fields->field_default;
                                     // Grab form responses
                                     $field_response = trim($field->nodeValue);
                                     if ($field_response != '') {
                                         // Initialize form response model
                                         $new_form_response = new Form_Response_Model();
                                         $new_form_response->incident_id = $new_report->id;
                                         $new_form_response->form_field_id = $match_field_id;
                                         // For radio buttons, checkbox fields and drop downs, make sure form responses are
                                         // within bounds of allowable options for that field
                                         // Split field defaults into individual values
                                         $field_defaults = explode(',', $match_field_defaults);
                                         /* Radio buttons and Drop down fields which take single responses */
                                         if ($match_field_type == 5 or $match_field_type == 7) {
                                             foreach ($field_defaults as $match_field_default) {
                                                 // Carry out a case insensitive string comparison
                                                 $new_form_response->form_response = strcasecmp($match_field_default, $field_response) == 0 ? $match_field_default : NULL;
                                             }
                                         }
                                         // Checkboxes which
                                         if ($match_field_type == 6) {
                                             // Split user responses into individual value
                                             $responses = explode(',', $field_response);
                                             $values = array();
                                             foreach ($match_field_defaults as $match_field_default) {
                                                 foreach ($responses as $response) {
                                                     $values[] = strcasecmp($match_field_default, $response) == 0 ? $match_field_default : NULL;
                                                 }
                                             }
                                             // Concatenate checkbox values into a string, separated by a comma
                                             $new_form_response->form_response = implode(",", $values);
                                         } else {
                                             $new_form_response->form_response = $field_response;
                                         }
                                         // Only save if form response is not empty
                                         if ($new_form_response->form_response != NULL) {
                                             $new_form_response->save();
                                         }
                                         // Add this to array of form responses added
                                         $this->incident_responses_added[] = $new_form_response->id;
                                     }
                                 } else {
                                     $this->notices[] = Kohana::lang('import.xml.form_field_no_match') . $this->totalreports . ': "' . $field_name . '" on form "' . $new_report->form->form_title . '"';
                                 }
                             }
                         }
                     }
                 }
                 /* Step 5: Save incident persons for this report */
                 // Report Personal Information
                 $personal_info = $report->getElementsByTagName('personal_info');
                 // If personal info exists
                 if ($personal_info->length > 0) {
                     $report_info = $personal_info->item(0);
                     // First Name
                     $firstname = xml::get_node_text($report_info, 'first_name');
                     // Last Name
                     $lastname = xml::get_node_text($report_info, 'last_name');
                     // Email
                     $r_email = xml::get_node_text($report_info, 'email');
                     $email = ($r_email and valid::email($r_email)) ? $r_email : NULL;
                     $new_incident_person = new Incident_Person_Model();
                     $new_incident_person->incident_id = $new_report->id;
                     $new_incident_person->person_date = $new_report->incident_dateadd;
                     // Make sure that at least one of the personal info field entries is provided
                     if ($firstname or $lastname or $email != NULL) {
                         $new_incident_person->person_first = $firstname ? $firstname : NULL;
                         $new_incident_person->person_last = $lastname ? $firstname : NULL;
                         $new_incident_person->person_email = $email;
                         $new_incident_person->save();
                         // Add this to array of incident persons added during import
                         $this->incident_persons_added[] = $new_incident_person->id;
                     }
                 }
                 /* Step 6: Save media links for this report */
                 // Report Media
                 $media = $report->getElementsByTagName('media');
                 if ($media->length > 0) {
                     $media = $media->item(0);
                     foreach ($media->getElementsByTagName('item') as $media_element) {
                         $media_link = trim($media_element->nodeValue);
                         $media_date = $media_element->getAttribute('date');
                         if (!empty($media_link)) {
                             $media_item = new Media_Model();
                             $media_item->location_id = isset($new_location) ? $new_location->id : 0;
                             $media_item->incident_id = $new_report->id;
                             $media_item->media_type = $media_element->getAttribute('type');
                             $media_item->media_link = $media_link;
                             $media_item->media_date = !empty($media_date) ? $media_date : $new_report->incident_date;
                             $media_item->save();
                         }
                     }
                 }
             }
         }
     }
     // end individual report import
     // If we have errors, return FALSE, else TRUE
     return count($this->errors) === 0;
 }
예제 #29
0
        $category_description = html::escape(Category_Lang_Model::category_description($category));
        $color_css = 'class="category-icon swatch" style="background-color:#' . $category_color . '"';
        if ($category_info[2] != NULL) {
            $category_image = html::image(array('src' => $category_image));
            $color_css = 'class="category-icon"';
        }
        echo '<li>' . '<a href="#" id="cat_' . $category . '" title="' . $category_description . '">' . '<span ' . $color_css . '>' . $category_image . '</span>' . '<span class="category-title">' . $category_title . '</span>' . '</a>';
        // Get Children
        echo '<div class="hide" id="child_' . $category . '">';
        if (sizeof($category_info[3]) != 0) {
            echo '<ul>';
            foreach ($category_info[3] as $child => $child_info) {
                $child_title = html::escape($child_info[0]);
                $child_color = $child_info[1];
                $child_image = $child_info[2] != NULL ? url::convert_uploaded_to_abs($child_info[2]) : NULL;
                $child_description = html::escape(Category_Lang_Model::category_description($child));
                $color_css = 'class="category-icon swatch" style="background-color:#' . $child_color . '"';
                if ($child_info[2] != NULL) {
                    $child_image = html::image(array('src' => $child_image));
                    $color_css = 'class="category-icon"';
                }
                echo '<li>' . '<a href="#" id="cat_' . $child . '" title="' . $child_description . '">' . '<span ' . $color_css . '>' . $child_image . '</span>' . '<span class="category-title">' . $child_title . '</span>' . '</a>' . '</li>';
            }
            echo '</ul>';
        }
        echo '</div></li>';
    }
    ?>
			</ul>
			<?php 
}
예제 #30
0
        echo rawurlencode($badge['id']);
        ?>
')"><?php 
        echo Kohana::lang('ui_admin.revoke');
        ?>
</a>
													<?php 
    }
    ?>

											</td>
											<td class="col-4" style="width:120px;">

												<ul>
													<li><a href="javascript:badgeAction('d','<?php 
    echo utf8::strtoupper(html::escape(Kohana::lang('ui_admin.delete_badge')));
    ?>
','<?php 
    echo rawurlencode($badge['id']);
    ?>
')" class="del"><?php 
    echo Kohana::lang('ui_admin.delete_badge');
    ?>
</a></li>
												</ul>

											</td>
										</tr>
								<?php 
}
?>