コード例 #1
0
ファイル: default.php プロジェクト: MrJookie/pm
 $this->menu->start(array('class' => 'btn-mini btn-link'));
 $itm_icon = 'icon-menu-2';
 $itm_txt = 'COM_PROJECTFORK_DETAILS_LABEL';
 $itm_link = '#collapse-' . $x;
 $this->menu->itemCollapse($itm_icon, $itm_txt, $itm_link);
 $this->menu->itemDivider();
 $this->menu->itemEdit('taskform', $item->id, $can_edit || $can_edit_own);
 $this->menu->itemTrash('tasks', $x, $can_edit || $can_edit_own);
 if ($can_track) {
     $this->menu->itemDivider();
     $this->menu->itemJavaScript('icon-clock ', 'COM_PROJECTFORK_TASKS_TRACK_TIME', 'PFtask.trackItem(' . $item->id . ');');
 }
 if ($can_edit || $can_edit_own) {
     $itm_icon = 'icon-plus';
     $itm_txt = 'COM_PROJECTFORK_ASSIGN_TO_USER';
     $itm_link = PFusersHelperRoute::getUsersRoute() . '&layout=modal&tmpl=component&field=PFtaskAssignUser';
     $this->menu->itemDivider();
     $this->menu->itemModal($itm_icon, $itm_txt, $itm_link, "PFlist.setTarget(" . $x . ");");
 }
 if ($can_change) {
     $itm_icon = 'icon-warning';
     $itm_pfx = 'COM_PROJECTFORK_PRIORITY';
     $itm_ac = 'PFtask.priority(' . $x . ',';
     $this->menu->itemDivider();
     $this->menu->itemJavaScript($itm_icon, $itm_pfx . '_VERY_LOW', $itm_ac . ' 1, \'' . addslashes(JText::_($itm_pfx . '_VERY_LOW')) . '\')');
     $this->menu->itemJavaScript($itm_icon, $itm_pfx . '_LOW', $itm_ac . ' 2, \'' . addslashes(JText::_($itm_pfx . '_LOW')) . '\')');
     $this->menu->itemJavaScript($itm_icon, $itm_pfx . '_MEDIUM', $itm_ac . ' 3, \'' . addslashes(JText::_($itm_pfx . '_MEDIUM')) . '\')');
     $this->menu->itemJavaScript($itm_icon, $itm_pfx . '_HIGH', $itm_ac . ' 4, \'' . addslashes(JText::_($itm_pfx . '_HIGH')) . '\')');
     $this->menu->itemJavaScript($itm_icon, $itm_pfx . '_VERY_HIGH', $itm_ac . ' 5, \'' . addslashes(JText::_($itm_pfx . '_VERY_HIGH')) . '\')');
 }
 $this->menu->end();
コード例 #2
0
 /**
  * Generates the javascript needed for this field
  *
  * @param     string    $onchange    Onchange event javascript
  * @param     boolean   $multiple    True if multiple users are allowed to be selected
  *
  * @return    array     $script      The generated javascript
  */
 protected function getJavascript($onchange = '', $multiple = false)
 {
     $attr = $this->element['class'] ? ' class=\\"' . (string) $this->element['class'] . '\\"' : '';
     $attr .= $this->element['size'] ? ' size=\\"' . (int) $this->element['size'] . '\\"' : '';
     $groups = $this->getGroups();
     $excluded = $this->getExcluded();
     if (JFactory::getApplication()->isSite()) {
         $link = PFusersHelperRoute::getUsersRoute() . '&layout=modal&tmpl=component&field=' . $this->id . (isset($groups) ? '&groups=' . base64_encode(json_encode($groups)) : '') . (isset($excluded) ? '&excluded=' . base64_encode(json_encode($excluded)) : '');
     } else {
         $link = 'index.php?option=com_users&view=users&layout=modal&tmpl=component&field=' . $this->id . (isset($groups) ? '&groups=' . base64_encode(json_encode($groups)) : '') . (isset($excluded) ? '&excluded=' . base64_encode(json_encode($excluded)) : '');
     }
     $script = array();
     $script[] = 'function jSelectUser_' . $this->id . '(id, title)';
     $script[] = '{';
     $script[] = '    var ifld = jQuery("#' . $this->id . '_i");';
     $script[] = '    if (ifld.length) {var i = ifld.val();}';
     $script[] = '    if (typeof i != "undefined") {';
     $script[] = '        var old_id = jQuery("#' . $this->id . '_id_" + i).val();';
     $script[] = '        if (old_id != id) {';
     $script[] = '            jQuery("#' . $this->id . '_" + i + "_id").val(id);';
     $script[] = '            jQuery("#' . $this->id . '_" + i + "_name").val(title);';
     $script[] = '            ' . $onchange;
     $script[] = '        }';
     $script[] = '    }';
     $script[] = '    else {';
     $script[] = '        var old_id = document.getElementById("' . $this->id . '_id").value;';
     $script[] = '        if (old_id != id) {';
     $script[] = '            document.getElementById("' . $this->id . '_id").value = id;';
     $script[] = '            document.getElementById("' . $this->id . '_name").value = title;';
     $script[] = '            ' . $onchange;
     $script[] = '        }';
     $script[] = '    }';
     $script[] = '    SqueezeBox.close();';
     $script[] = '}';
     if ($multiple) {
         if (JFactory::getApplication()->isSite()) {
             $script[] = 'function jAddUserField_' . $this->id . '()';
             $script[] = '{';
             $script[] = '    var l = jQuery("#' . $this->id . '_list");';
             $script[] = '    var i = l.children("li").length + 1;';
             $script[] = '    var txt = "<input type=\\"text\\" id=\\"' . $this->id . '_" + i + "_name\\" value=\\"\\" disabled=\\"disabled\\"' . $attr . ' />";';
             $script[] = '    var btn = "<a class=\\"modal_' . $this->id . '_" + i + " btn\\" title=\\"' . JText::_('JLIB_FORM_CHANGE_USER') . '\\"' . ' href=\\"' . $link . '\\""';
             $script[] = '            + " rel=\\"{handler: \'iframe\', size: {x: 800, y: 500}}\\" onclick=\\"jQuery(\'#' . $this->id . '_i\').val(" + i + ");\\">"';
             $script[] = '            + "' . JText::_('JLIB_FORM_CHANGE_USER') . '"';
             $script[] = '            + "</a>"';
             $script[] = '    var clr = "<a onclick=\\"jRemoveUserField_' . $this->id . '(this)\\" class=\\"btn\\">"';
             $script[] = '            + "' . JText::_('COM_PROJECTFORK_FIELD_CLEAR_LABEL') . '"';
             $script[] = '            + "</a>"';
             $script[] = '    var hdn = "<input type=\\"hidden\\" id=\\"' . $this->id . '_" + i + "_id\\" value=\\"\\" name=\\"' . $this->name . '\\" />";';
             $script[] = '    l.append("<li>" + txt + btn + clr + hdn + "</li>");';
             $script[] = '    SqueezeBox.initialize({});SqueezeBox.assign($$("a.modal_' . $this->id . '_" + i), {parse: "rel"});';
             $script[] = '}';
             $script[] = 'function jRemoveUserField_' . $this->id . '(el)';
             $script[] = '{';
             $script[] = '    jQuery(el).closest("li").remove();';
             $script[] = '}';
         } else {
             $script[] = 'function jAddUserField_' . $this->id . '()';
             $script[] = '{';
             $script[] = '    var l = jQuery("#' . $this->id . '_list");';
             $script[] = '    var i = l.children("li").length + 1;';
             $script[] = '    var txt = "<input type=\\"text\\" id=\\"' . $this->id . '_" + i + "_name\\" value=\\"\\" disabled=\\"disabled\\"' . $attr . ' />";';
             $script[] = '    var btn = "<div class=\\"button2-left\\"><div class=\\"blank\\">"';
             $script[] = '            + "<a class=\\"modal_' . $this->id . '_" + i + " btn\\" title=\\"' . JText::_('JLIB_FORM_CHANGE_USER') . '\\"' . ' href=\\"' . $link . '\\""';
             $script[] = '            + " rel=\\"{handler: \'iframe\', size: {x: 800, y: 500}}\\" onclick=\\"jQuery(\'#' . $this->id . '_i\').val(" + i + ");\\">"';
             $script[] = '            + "' . JText::_('JLIB_FORM_CHANGE_USER') . '"';
             $script[] = '            + "</a>"';
             $script[] = '            + "</div></div>"';
             $script[] = '    var clr = "<div class=\\"button2-left\\"><div class=\\"blank\\"><a onclick=\\"jRemoveUserField_' . $this->id . '(this)\\" class=\\"btn\\">"';
             $script[] = '            + "' . JText::_('COM_PROJECTFORK_FIELD_CLEAR_LABEL') . '"';
             $script[] = '            + "</a></div></div><div class=\\"clr\\"></div>"';
             $script[] = '    var hdn = "<input type=\\"hidden\\" id=\\"' . $this->id . '_" + i + "_id\\" value=\\"\\" name=\\"' . $this->name . '\\" />";';
             $script[] = '    l.append("<li>" + txt + btn + clr + hdn + "</li>");';
             $script[] = '    SqueezeBox.initialize({});SqueezeBox.assign($$("a.modal_' . $this->id . '_" + i), {parse: "rel"});';
             $script[] = '}';
             $script[] = 'function jRemoveUserField_' . $this->id . '(el)';
             $script[] = '{';
             $script[] = '    jQuery(el).closest("li").remove();';
             $script[] = '}';
         }
     }
     return $script;
 }
コード例 #3
0
ファイル: userlink.php プロジェクト: MrJookie/pm
 /**
  * Method to link to a Projectfork user profile page
  *
  * @param     integer    $id      The user id
  * @param     string     $name    The user name
  *
  * @return    string              The profile url
  */
 protected static function projectfork($id, $name = null)
 {
     static $router = null;
     // Include the route helper once
     if (is_null($router)) {
         $file = JPATH_SITE . '/components/com_pfusers/helpers/route.php';
         if (!file_exists($file)) {
             $router = false;
         } else {
             require_once $file;
             $router = true;
         }
     }
     // Return anchor link if the router was not found
     if (!$router) {
         return '#notfound';
     }
     // Create slug
     $slug = (int) $id . (empty($name) ? '' : ':' . $name);
     // Return link
     return PFusersHelperRoute::getUserRoute($slug);
 }
コード例 #4
0
">
			    				<img title="<?php 
    echo $this->escape($item->name);
    ?>
"
		                             src="<?php 
    echo JHtml::_('projectfork.avatar.path', $item->id);
    ?>
"
		                             class="img-circle hasTooltip"
		                             style="height:128px;width:auto;"
		                        />
			    			</a>
			    			<div class="text-large">
				    			<a href="<?php 
    echo PFusersHelperRoute::getUserRoute($slug);
    ?>
">
                                    <?php 
    echo $this->escape($item->name);
    ?>
                                </a>
			    			</div>
			    			<div class="small"><?php 
    echo $this->escape($item->username);
    ?>
</div>
			    			<div class="small"><a href="mailto:<?php 
    echo $this->escape($item->email);
    ?>
"><?php 
コード例 #5
0
 public function assignedUsers($i, $id, $asset, $assigned, $access = false, $css_class = 'btn-mini')
 {
     $count = count($assigned);
     $class = '';
     $title = $count > 0 ? $assigned[0]->name : JText::_('COM_PROJECTFORK_UNASSIGNED');
     $title .= $count > 1 ? ' +' . ($count - 1) : '';
     $class .= ' ' . $css_class;
     $link = PFusersHelperRoute::getUsersRoute() . '&amp;layout=modal&amp;tmpl=component&amp;field=assigned' . $i;
     if (!$access && $count < 2) {
         $html[] = $this->start(array('title' => $title, 'class' => $class, 'single-button' => true), true);
         $html[] = '<input type="hidden" id="assigned' . $i . '" name="assigned[' . $id . ']" value="0"/>';
         return implode("\n", $html);
     } else {
         // Build the script.
         $script = array();
         $script[] = '    function jSelectUser_assigned' . $i . '(id, title) {';
         $script[] = '        document.getElementById("assigned' . $i . '").value = id';
         $script[] = '        SqueezeBox.close();';
         $script[] = '        return listItemTask("cb' . $i . '","' . $asset . '.addUsers");';
         $script[] = '    }';
         // Add the script to the document head.
         JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
         $html[] = $this->start(array('title' => $title, 'class' => $class), true);
     }
     if ($access) {
         $html[] = $this->itemModal('icon-plus', 'COM_PROJECTFORK_ASSIGN_TO_USER', $link, 800, 500, true);
         if ($count > 1) {
             $html[] = $this->itemDivider(true);
         }
     }
     foreach ($assigned as $user) {
         $action = "\$('filter_assigned').set('value', " . intval($user->user_id) . "); submitbutton();";
         $html[] = $this->itemJavaScript('icon-user', $user->name, $action, true);
     }
     $html[] = $this->end(true);
     $html[] = '<input type="hidden" id="assigned' . $i . '" name="assigned[' . $id . ']" value="0"/>';
     return implode("\n", $html);
 }