private function _send_by_mail(org_openpsa_invoices_invoice_dba $invoice) { $customerCard = org_openpsa_widgets_contact::get($invoice->customerContact); $contactDetails = $customerCard->contact_details; $invoice_label = $invoice->get_label(); $invoice_date = date($this->_l10n_midcom->get('short date'), $invoice->date); // generate pdf, only if not existing yet $pdf_files = org_openpsa_helpers::get_attachment_urls($invoice, "pdf_file"); if (count($pdf_files) == 0) { org_openpsa_invoices_handler_pdf::render_and_attach_pdf($invoice); } $mail = new org_openpsa_mail(); // define replacements for subject / body $mail->parameters = array("INVOICE_LABEL" => $invoice_label, "INVOICE_DATE" => $invoice_date, "FIRSTNAME" => $contactDetails["firstname"], "LASTNAME" => $contactDetails["lastname"]); $mail->to = $contactDetails["email"]; $mail->from = $this->_config->get('invoice_mail_from_address'); $mail->subject = $this->_config->get('invoice_mail_title'); $mail->body = $this->_config->get('invoice_mail_body'); // attach pdf to mail if ($mail->can_attach()) { $pdf_files = org_openpsa_helpers::get_attachment_urls($invoice, "pdf_file"); if (count($pdf_files) > 0) { foreach ($pdf_files as $guid => $url) { $att = array(); $att['name'] = basename($url) . ".pdf"; $att['mimetype'] = "application/pdf"; $fp = fopen($url, "r"); if (!$fp) { //Failed to open attachment for reading, skip the file continue; } $att['content'] = ''; while (!feof($fp)) { $att['content'] .= fread($fp, 4096); } fclose($fp); debug_add("adding attachment '{$att['name']}' to attachments array of invoice mail"); $mail->attachments[] = $att; unset($att); } } } if (!$mail->send()) { $this->_request_data['message']['message'] = sprintf($this->_l10n->get('unable to deliver mail: %s'), $mail->get_error_message()); return false; } else { $invoice->set_parameter($this->_component, 'sent_by_mail', time()); return $this->_mark_as_sent($invoice); } }
} } catch (midcom_error $e) { $product = false; $unit = $data['l10n']->get('unit'); } ?> <div class="org_openpsa_sales_salesproject_deliverable &(status);"> <div class="sidebar"> <div class="contacts area"> <?php echo "<h2>" . $data['l10n']->get('customer') . "</h2>\n"; $customer = $data['salesproject']->get_customer(); echo "<dl>\n<dt>\n" . $customer->render_link() . "</dl>\n</dt>\n"; $contacts = $data['salesproject']->contacts; foreach ($contacts as $contact_id => $active) { $person_card = org_openpsa_widgets_contact::get($contact_id); $person_card->show(); } ?> </div> <?php if ($product) { ?> <div class="products area"> <?php echo "<h2>" . $data['l10n']->get('product') . "</h2>\n"; echo $product->render_link() . "\n"; ?> </div> <?php
$entry['index_customer'] = $customer->official; if ($data['invoices_url']) { $entry['customer'] = "<a href=\"{$data['invoices_url']}list/customer/all/{$customer->guid}/\" title=\"{$customer->name}: {$customer->official}\">{$customer->official}</a>"; } else { $entry['customer'] = $customer->official; } } catch (midcom_error $e) { $entry['customer'] = ''; $entry['index_customer'] = ''; } $entry['index_contact'] = ''; $entry['contact'] = ''; try { $contact = org_openpsa_contacts_person_dba::get_cached($invoice->customerContact); $entry['index_contact'] = $contact->rname; $contact_card = org_openpsa_widgets_contact::get($invoice->customerContact); $entry['contact'] = $contact_card->show_inline(); } catch (midcom_error $e) { } $entry['sum'] = $invoice->sum; $entry['index_vat'] = $invoice->vat; $entry['vat'] = $invoice->vat . ' %'; $entry['vat_sum'] = $vat_sum; $entries[] = $entry; } echo '<script type="text/javascript">//<![CDATA['; echo "\nvar " . $grid_id . '_entries = ' . json_encode($entries); echo "\n//]]></script>"; ?> <div class="report &(data['table_class']); org_openpsa_invoices full-width">
echo "<row>"; echo "<cell>" . $document->id . "</cell>"; echo "<cell><![CDATA[" . $document->title . "]]></cell>"; $class = 'document ' . $document->get_class(); $link_html = "<![CDATA["; $link_html .= "<a href='" . $prefix . $path . "document/" . $document->guid . "/' class='" . $class . "'>"; $link_html .= "<img class='document_icon' src='" . $icon . "' />"; $link_html .= "<span>" . $document->title . "</span></a>"; $link_html .= "]]>"; echo "<cell>" . $link_html . "</cell>"; echo "<cell> " . $download_url . "</cell>"; //set contact-widget if (empty($document->author)) { $author = org_openpsa_widgets_contact::get($document->metadata->creator); } else { $author = org_openpsa_widgets_contact::get($document->author); } // creator_index, creator-vcard & revised date echo "<cell>" . $author->contact_details['lastname'] . ", " . $author->contact_details['firstname'] . "</cell>"; echo "<cell><![CDATA[<span class='jqgrid_person'>" . $author->show_inline() . "</span>]]></cell>"; echo "<cell> " . $document->metadata->revised . "</cell>"; echo "<cell><![CDATA[<span class='jqgrid_date'>" . date("d.m.Y H:m", $document->metadata->revised) . "</span>]]></cell>"; //filesize-index & modified file_size echo "<cell>" . $file_size . "</cell>"; echo "<cell><![CDATA[<span class='jqgrid_size'>" . midcom_helper_misc::filesize_to_string($file_size) . "</span>]]></cell>"; //level & parent of document echo "<cell>" . $level . "</cell>"; echo "<cell>" . $parent . "</cell>"; // leaf = true , expanded = false echo "<cell>true</cell>"; echo "<cell>false</cell>";
<script type="text/javascript"> <?php //add static data to jqgrid if wanted $start = true; if (!array_key_exists('dynamic_load', $data) && array_key_exists('entries', $data)) { $rows = array(); foreach ($data['entries'] as $entry) { $row = array('id' => $entry->id, 'index_name' => $entry->title, 'description' => $entry->text, 'index_date' => $entry->followUp); $link_html = "<a href='" . $data['url_prefix'] . "edit/" . $entry->guid . "/'>"; $link_html .= "<span >" . $entry->title . "</span></a>"; $row['name'] = $link_html; $row['date'] = date('Y-m-d', $entry->metadata->created); try { $creator = org_openpsa_contacts_person_dba::get_cached($entry->metadata->creator); $row['creator_index'] = $creator->rname; $creator_card = org_openpsa_widgets_contact::get($entry->metadata->creator); $row['creator'] = $creator_card->show_inline(); } catch (midcom_error $e) { $row['creator_index'] = ''; $row['creator'] = ''; } if ($entry->closed) { $row['closed'] = midcom::get('i18n')->get_string('finished', 'org.openpsa.relatedto'); } else { $row['closed'] = midcom::get('i18n')->get_string('open', 'org.openpsa.relatedto'); } $rows[] = $row; } echo 'var entries = ' . json_encode($rows) . ";\n"; } ?>
<?php $link =& $data['link']; $task =& $data['other_obj']; ?> <li class="&(data['type']);" id="org_openpsa_relatedto_line_&(link['guid']);"> <span class="icon">&(data['icon']:h);</span> <span class="title">&(data['title']:h);</span> <ul class="metadata"> <?php // Deadline echo "<li>" . midcom::get('i18n')->get_string('deadline', 'org.openpsa.projects') . ": " . strftime('%x', $task->end) . "</li>"; // Resources echo "<li>" . midcom::get('i18n')->get_string('resources', 'org.openpsa.projects') . ": "; $task->get_members(); foreach ($task->resources as $resource_id => $confirmed) { $resource_card = org_openpsa_widgets_contact::get($resource_id); echo $resource_card->show_inline() . " "; } echo "</li>\n"; ?> </ul> <div id="org_openpsa_relatedto_details_&(task.guid);" class="details hidden" style="display: none;"> </div> <?php //TODO: necessary JS stuff to load details (which should in turn include the tasks own relatedtos) via AHAH org_openpsa_relatedto_handler_relatedto::render_line_controls($link, $data['other_obj']); ?> </li>
<div class="bookings"> <?php echo "<h2>" . $data['l10n']->get('booked times') . "</h2>\n"; if (count($data['task_bookings']['confirmed']) > 0) { echo "<ul>\n"; foreach ($data['task_bookings']['confirmed'] as $booking) { echo "<li>"; echo strftime('%x', $booking->start) . ' ' . date('H', $booking->start) . '-' . date('H', $booking->end); if ($data['calendar_node']) { echo ": <a href=\"#\" onclick=\"" . org_openpsa_calendar_interface::calendar_editevent_js($booking->guid, $data['calendar_node']) . "\">{$booking->title}</a>"; } else { echo ": {$booking->title}"; } echo " ("; foreach ($booking->participants as $participant_id => $display) { $participant = org_openpsa_widgets_contact::get($participant_id); echo $participant->show_inline(); } echo ")</li>\n"; } echo "</ul>\n"; } if ($data['task_booked_percentage'] >= 105) { $status = 'acceptable'; } else { if ($data['task_booked_percentage'] >= 95) { $status = 'ok'; } else { if ($data['task_booked_percentage'] >= 75) { $status = 'acceptable'; } else {
<?php $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX); $project =& $data['project']; $manager_card = org_openpsa_widgets_contact::get($project->manager); ?> <tr> <td><?php echo "<a href=\"{$prefix}project/{$project->guid}/\">{$project->title}</a>\n"; ?> </td> <td><?php echo $manager_card->show_inline(); ?> </td> <td><?php try { $customer = new midcom_db_group($project->customer); if ($data['contacts_url']) { echo "<a href=\"{$data['contacts_url']}group/{$customer->guid}/\">{$customer->official}</a>"; } else { echo $customer->official; } } catch (midcom_error $e) { echo $data['l10n']->get('no customer'); } ?> </td> <td> <?php if (isset($data['priority_array']) && array_key_exists($task->priority, $data['priority_array'])) {
public function get_row(midcom_core_dbaobject $task) { $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX); $task_url = $prefix . "task/{$task->guid}/"; $celldata = $this->get_table_row_data($task, $this->_request_data); $manager_card = org_openpsa_widgets_contact::get($task->manager); $entry = array(); $entry['id'] = $task->id; $entry['index_task'] = $task->title; $entry['task'] = '<a href="' . $task_url . '"><img class="status-icon" src="' . MIDCOM_STATIC_URL . '/stock-icons/16x16/' . $task->get_icon() . '" /> ' . $task->title . '</a>'; if ($this->_request_data['view_identifier'] == 'my_tasks' || $this->_request_data['view_identifier'] == 'project_tasks') { $entry['status_control'] = org_openpsa_projects_workflow::render_status_control($task); $status_type = $this->_get_status_type($task); $entry['index_status'] = $this->_status_order[$status_type]; $entry['status'] = $this->_l10n->get($status_type . ' tasks'); $controls = $this->_render_workflow_controls($task); if ($controls != '') { $entry['task'] = '<div class="title">' . $entry['task'] . '</div><div class="details">' . $controls . '</div>'; } } $entry['index_project'] = $celldata['index_parent']; $entry['project'] = $celldata['parent']; $entry['index_priority'] = $task->priority; $entry['priority'] = $task->priority; if (isset($this->_request_data['priority_array']) && array_key_exists($task->priority, $this->_request_data['priority_array'])) { $entry['priority'] = '<span title="' . $this->_l10n->get($this->_request_data['priority_array'][$task->priority]) . '">' . $task->priority . '</span>'; } if ($this->_request_data['view_identifier'] != 'agreement') { $entry['index_customer'] = $celldata['index_customer']; $entry['customer'] = $celldata['customer']; } $entry['manager'] = $manager_card->show_inline(); $entry['index_manager'] = preg_replace('/<span.*?class="uid".*?>.*?<\\/span>/', '', $entry['manager']); $entry['index_manager'] = strip_tags($entry['index_manager']); $entry['start'] = strftime('%Y-%m-%d', $task->start); $entry['end'] = strftime('%Y-%m-%d', $task->end); if ($this->_request_data['view_identifier'] != 'project_tasks') { $entry['index_reported'] = $task->reportedHours; $entry['reported'] = round($task->reportedHours, 2); if ($task->plannedHours > 0) { $entry['reported'] .= ' / ' . round($task->plannedHours, 2); } } else { $entry['planned_hours'] = $task->plannedHours; $entry['invoiced_hours'] = $task->invoicedHours; $entry['approved_hours'] = $task->approvedHours; $entry['reported_hours'] = $task->reportedHours; } return $entry; }
public function get_row(midcom_core_dbaobject $document) { $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX); $entry = array(); $entry['id'] = $document->id; $entry['index_title'] = $document->title; $entry['index_filesize'] = 0; $entry['filesize'] = ''; $entry['mimetype'] = ''; $icon = MIDCOM_STATIC_URL . '/stock-icons/mime/gnome-text-blank.png'; $alt = ''; $att = $document->load_attachment(); if ($att) { $icon = midcom_helper_misc::get_mime_icon($att->mimetype); $alt = $att->name; $stats = $att->stat(); $entry['index_filesize'] = $stats[7]; $entry['filesize'] = midcom_helper_misc::filesize_to_string($stats[7]); $entry['mimetype'] = org_openpsa_documents_document_dba::get_file_type($att->mimetype); } $title = '<a class="tab_escape" href="' . $prefix . 'document/' . $document->guid . '/"><img src="' . $icon . '"'; $title .= 'alt="' . $alt . '" style="border: 0px; height: 16px; vertical-align: middle" /> ' . $document->title . '</a>'; $entry['title'] = $title; $entry['created'] = strftime('%Y-%m-%d %X', $document->metadata->created); $entry['index_author'] = ''; $entry['author'] = ''; if ($document->author) { $author = org_openpsa_contacts_person_dba::get_cached($document->author); $entry['index_author'] = $author->rname; $author_card = org_openpsa_widgets_contact::get($author->guid); $entry['author'] = $author_card->show_inline(); } return $entry; }
$event =& $data['other_obj']; ?> <li class="event" id="org_openpsa_relatedto_line_&(link['guid']);"> <span class="icon">&(data['icon']:h);</span> <span class="title">&(data['title']:h);</span> <ul class="metadata"> <li class="time location"><?php echo $event->format_timeframe() . ", {$event->location}"; ?> </li> <?php // Participants echo "<li class=\"members\">" . midcom::get('i18n')->get_string('participants', 'org.openpsa.calendar') . ": "; foreach ($event->participants as $person_id => $confirmed) { $participant_card = org_openpsa_widgets_contact::get($person_id); echo $participant_card->show_inline() . " "; } echo "</li>\n"; ?> </ul> <div id="org_openpsa_relatedto_details_url_&(event.guid);" style="display: none;" title="&(data['raw_url']);"></div> <div id="org_openpsa_relatedto_details_&(event.guid);" class="details hidden" style="display: none;"> </div> <?php //TODO: necessary JS stuff to load details (which should in turn include the events own relatedtos) via AHAH echo org_openpsa_relatedto_handler_relatedto::render_line_controls($link, $data['other_obj']); ?> </li>
/** * Renders a wikipage line * * See the _show_render documentation for details about styling * * @param array &$link The necessary link information * @param object &other_obj The link target */ private static function _render_line_wikipage_email(&$link, &$other_obj) { echo " <li class=\"note email\" id=\"org_openpsa_relatedto_line_{$link['guid']}\">\n"; $nap = new midcom_helper_nav(); $node = $nap->get_node($other_obj->topic); if (!$node) { // The page isn't from this site return; } $page_url = "{$node[MIDCOM_NAV_FULLURL]}{$other_obj->name}"; echo " <span class=\"title\"><a href=\"{$page_url}\" target=\"wiki_{$other_obj->guid}\">{$other_obj->title}</a></span>\n"; // Start metadata UL echo " <ul class=\"metadata\">\n"; // Time echo ' <li class="time">' . strftime('%x', $other_obj->metadata->created) . "</li>\n"; // Author echo " <li class=\"members\">" . midcom::get('i18n')->get_string('sender', 'net.nemein.wiki') . ": "; $author_card = org_openpsa_widgets_contact::get($other_obj->metadata->creator); echo $author_card->show_inline() . " "; echo " </li>\n"; // Recipients self::_render_line_wikipage_email_recipients($other_obj); // End metadata UL echo " </ul>\n"; echo " <div id=\"org_openpsa_relatedto_details_url_{$other_obj->guid}\" style=\"display: none;\" title=\"{$node[MIDCOM_NAV_FULLURL]}raw/{$other_obj->name}/\"></div>\n"; echo " <div id=\"org_openpsa_relatedto_details_{$other_obj->guid}\" class=\"details hidden\" style=\"display: none;\">\n"; echo " </div>\n"; //TODO: get correct node and via it then handle details trough AHAH (and when we have node we can use proper link in page_url as well self::render_line_controls($link, $other_obj); echo " </li>\n"; }
echo "<h2>" . $data['l10n']->get('manager') . "</h2>\n"; $contact = org_openpsa_widgets_contact::get($project->manager); echo $contact->show_inline(); } else { if (count($project->resources) > 0) { echo "<h2>" . $data['l10n']->get('resources') . "</h2>\n"; foreach ($project->resources as $contact_id => $display) { $contact = org_openpsa_widgets_contact::get($contact_id); echo $contact->show_inline() . " "; } } } if (count($project->contacts) > 0) { echo "<h2>" . $data['l10n']->get('contacts') . "</h2>\n"; foreach ($project->contacts as $contact_id => $display) { $contact = org_openpsa_widgets_contact::get($contact_id); echo $contact->show(); } } ?> </div> <div class="main org_openpsa_projects_project"> <h1><?php echo $data['l10n']->get('project'); ?> : &(view['title']:h);</h1> <div class="status <?php echo $project->status_type; ?>
<?php $sums_all = $data['sums_all']; ?> </tbody> <tfoot> <?php $colspan = 4; if ($data['handler_id'] != 'deliverable_report') { $colspan++; foreach ($data['sums_per_person'] as $person_id => $sums) { $owner_card = org_openpsa_widgets_contact::get($person_id); ?> <tr> <td colspan="&(colspan);"><?php echo $owner_card->show_inline(); ?> </td> <td class="numeric"><?php echo sprintf("%01.2f", $sums['price']); ?> </td> <td class="numeric"><?php echo sprintf("%01.2f", $sums['cost']); ?> </td> <td class="numeric"><?php echo sprintf("%01.2f", $sums['profit']); ?> </td> <td></td>
} // Display invoiced hours and tasks if (isset($data['sorted_reports']) && count($data['sorted_reports']['reports']) > 0) { $grid_id = 'invoice_' . $invoice->number . '_hours_grid'; $guids = array(); $rows = array(); foreach ($data['sorted_reports']['reports'] as $report) { $row = array(); $guids[] = $report->guid; try { $task = org_openpsa_projects_task_dba::get_cached($report->task); $reporter = org_openpsa_contacts_person_dba::get_cached($report->person); } catch (midcom_error $e) { continue; } $reporter_card = org_openpsa_widgets_contact::get($report->person); $approved_img_src = MIDCOM_STATIC_URL . '/stock-icons/16x16/'; if ($report->is_approved()) { $approved_text = $data['l10n']->get('approved'); $approved_img_src .= 'page-approved.png'; } else { $approved_text = $data['l10n']->get('not approved'); $approved_img_src .= 'page-notapproved.png'; } $approved_img = "<img src='{$approved_img_src}' alt='{$approved_text}' title='{$approved_text}' />"; $row['id'] = $report->id; $row['index_date'] = $report->date; $row['date'] = date($data['l10n_midcom']->get('short date'), $report->date); $row['index_reporter'] = $reporter->rname; $row['reporter'] = $reporter_card->show_inline(); $row['hours'] = $report->hours;
$url = midcom_connection::get_url('self') . "midcom-permalink-{$page->guid}"; ?> <tr> <td> <a rel="note" class="subject url" href="&(url);">&(page.title);</a> </td> <td> &(version_string:h); </td> <td class="revisor"> <?php if ($history['user']) { $user = midcom::get('auth')->get_user($history['user']); if (is_object($user)) { if (class_exists('org_openpsa_widgets_contact')) { $user_card = org_openpsa_widgets_contact::get($user->guid); $person_label = $user_card->show_inline(); } else { $person = $user->get_storage(); $person_label = $person->name; } } echo " {$person_label}\n"; } else { if ($history['ip']) { echo " {$history['ip']}\n"; } } ?> </td> <td>
<h1>&(view['title']:h);</h1> <?php if ($data['campaign']->archived) { echo "<p class=\"archived\">" . sprintf($data['l10n']->get('archived on %s'), strftime('%x', $data['campaign']->archived)) . "</p>\n"; } ?> &(view['description']:h); <?php echo '<h2>' . $data['l10n']->get('testers') . '</h2>'; $data['campaign']->get_testers(); if (count($data['campaign']->testers) > 0) { $counter = 1; foreach ($data['campaign']->testers as $id => $bool) { $person = org_openpsa_widgets_contact::get($id); echo $person->show_inline(); if ($counter++ < count($data['campaign']->testers)) { echo ", "; } } } else { echo "<strong>" . $data['l10n']->get('no testers') . "</strong>"; } ?> <?php if (array_key_exists('campaign_members_count', $data) && $data['campaign_members_count'] > 0) { echo "<div class=\"area\">\n"; echo "<h2>" . sprintf($data['l10n']->get('%d members'), $data['campaign_members_count']) . "</h2>\n"; $data['campaign_members_qb']->show_pages();
<td><?php echo org_openpsa_helpers::format_number($view['value']); ?> </td> </tr> <tr> <th><?php echo $data['l10n']->get('profit'); ?> </th> <td><?php echo org_openpsa_helpers::format_number($view['profit']); ?> </td> </tr> <?php $owner_card = org_openpsa_widgets_contact::get($salesproject->owner); ?> <tr> <th><?php echo $data['l10n']->get('owner'); ?> </th> <td><?php echo $owner_card->show_inline(); ?> </td> </tr> </table>
<?php $link =& $data['link']; $page =& $data['other_obj']; $page_url = $data['page_url'] . $page->name; $author_card = org_openpsa_widgets_contact::get($page->metadata->creator); ?> <li class="note" id="org_openpsa_relatedto_line_&(link['guid']);"> <span class="icon">&(data['icon']:h);</span> <span class="title"><a href="&(page_url);" target="wiki_&(page.guid);">&(page.title);</a></span> <ul class="metadata"> <li class="time"><?php echo strftime('%x', $page->metadata->created); ?> </li> <li class="members"><?php echo midcom::get('i18n')->get_string('author', 'net.nemein.wiki') . ': '; echo $author_card->show_inline(); ?> </li> </ul> <div id="org_openpsa_relatedto_details_url_&(page.guid);" style="display: none;" title="&(data['page_url']);raw/&(page.name);/"></div> <div id="org_openpsa_relatedto_details_&(page.guid);" class="details hidden" style="display: none;"> </div> <?php echo org_openpsa_relatedto_handler_relatedto::render_line_controls($link, $data['other_obj']); ?> </li>
<?php $task_status = $data['object']; $status_changer_label = midcom::get('i18n')->get_string('system', 'org.openpsa.projects'); $target_person_label = midcom::get('i18n')->get_string('system', 'org.openpsa.projects'); $fallback_creator = midcom_db_person::get_cached(1); if ($task_status->metadata->creator && $task_status->metadata->creator != $fallback_creator->guid) { $status_changer = org_openpsa_widgets_contact::get($task_status->metadata->creator); $status_changer_label = $status_changer->show_inline(); } if ($task_status->targetPerson) { $target_person = org_openpsa_widgets_contact::get($task_status->targetPerson); $target_person_label = $target_person->show_inline(); } $message = sprintf(midcom::get('i18n')->get_string($task_status->get_status_message(), 'org.openpsa.projects'), $status_changer_label, $target_person_label); ?> <tr class="hour_report &(data['class']);"> <td class="time"> <?php echo date('H:i', $data['time']); ?> </td> <td> <?php try { $task = org_openpsa_projects_task_dba::get_cached($task_status->task); $task_label = $task->get_label(); if ($data['projects_url']) { $task_label = "<a href=\"{$data['projects_url']}task/{$task->guid}/\">{$task_label}</a>"; } echo $task_label;